7 ms·
Shell script Mac Apps
- cleverjake 14y agosee also - http://sveinbjorn.org/platypus http://sveinbjorn.org/platypus
- MagerValp 14y agoYes, please use Platypus instead, it'll save you a lot of trouble. The article's solution is very hackish and as you can tell from the comments you'll run into lots of issues.
- Craiggybear 14y agoWow. Platypus is very nice. I like the text window output option. Very, very nice. Thanks for the tip.
- zdw 14y agoFor basic GUI interaction, there's also cocoaDialog: http://mstratman.github.com/cocoadialog/ http://mstratman.github.com/cocoadialog/
- tednaleid 14y agoIt's a lot easier than the original post says (and it's mentioned in the comments). Just rename your shell script to end in `.command` and you can have it execute via a double click (or launch it with launchbar/quicksilver). I have this in my .zshrc to automatically create a new .command file for the current directory so I can easily open it up in MacVim: https://gist.github.com/3474341 https://gist.github.com/3474341
- jmdeldin 14y agoThis seems more cumbersome than opening AppleScript Editor, writing the following, and saving the script as an app. do shell script "my script" Despite being an obnoxious language, AppleScript is pretty handy for distributing shell scripts onto non-technical users' machines.
- thatjoshguy 14y agoI've recently fallen in love with Automator. Although it make have a few limitations, you can get around it by embedding AppleScript or Python. In two minutes I made a quick and dirty system wide workflow to download the selected URL.
- Argorak 14y agoA hidden gem in this post is open(1), which is one of the best command line utilities on the mac, especially because all of the sane default that most Apple apps have. I think `open -a Mail mydoc.pdf` (open Mail and create a Mail with attachment mydoc.pdf) is my favorite line of Mac shell magic ever.
- sausagefeet 14y agoWow! Any good collection of things you can do with open?
- Someone 14y agoHere is something you can do with man: type 'man commandname' to get a description of things you can do with commandmame. This may not work as intended in cases where a command has the same name as a function. The nicely recursive 'man man' will tell you how to work around that.
- sausagefeet 14y agoYou seem to be missing that the value is in combinators. See the PDF trick above for an example of something not covered in the man page.
- Someone 14y ago"Not covered in detail". From the man page: "open -a /Applications/TextEdit.app '/Volumes/Macintosh HD/foo.txt'" opens the document in the application specified (in this case, TextEdit) That is exactly what the example does. The only thing that may be slightly surprising is what Mail.app does when you drag a .pdf on it. But that is only slightly surprising; the only alternative I can think of is that it would beep and do nothing else. Also, the man page has several IMO more interesting examples than this "make a new mail from the command line, but you will have to use the GUI to fill in the destination address and to click 'Send'". For example, I did not know about "open -f", "open -n -W", and "open -h".
- deleted 14y ago[deleted]