I want to have a number of items on my desktop which will be used to launch some apps. E.g. launcher for MacVim with specific settings for each project. I don't know how does it name in Mac OS. I was tried to create executable .sh script but it opens Terminal, it is annoying. What is Mac way to do this?
3 Answers
AppleScript applet. You can use do shell script
to wrap your shell commands in an AppleScript applet that you can double-click.
-
It seems that AppleScript is what I need. Can you help me to fix it? Executing
do shell script "open -a MacVim"
works, but I want to do more vim stuff at start. The way is to start mvim instead of MacVim.app. I'm trying todo shell script "open /usr/local/bin/mvim --args -c ':cd ~/my/project'"
. This works fine but opens Termital too. How can I start mvim without Terminal opened? Jan 23, 2011 at 2:12 -
The solution is
do shell script "/usr/local/bin/mvim -c ':cd ~/my/project'"
Jan 23, 2011 at 2:16 -
I have saved this AppleScript as Application. It starts fine, but it it seems that apple script is still running after MacVim was opened. Is it possible to terminate script, but have MacVim running? Jan 23, 2011 at 2:32
Open Automator and create an Application with a single Run Shell Script action:
open -a MacVim
If you want to pass command-line arguments, invoke like this:
/Applications/Firefox.app/Contents/MacOS/firefox-bin -ProfileManager &
This application will launch Firefox and quit instantly (because of the trailing &
), leaving only Firefox running. You can even pass arguments that way.
Alternatively, create an application using AppleScript Editor with the following AppleScript code:
tell application "MacVim" to activate
This will simply launch the application. If you want to pass command line arguments, do it like this:
do shell script "open -a '/Users/danielbeck/Applications/Firefox.app' --args -ProfileManager"
Both ways (Automator and AppleScript applications) work fine and don't keep either Terminal or a script application running for more than a second or so. Using Automator, you can even create a Service if you choose so.