Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

AppleScript applet. You can use do shell script to wrap your shell commands in an AppleScript applet that you can double-click.

share|improve this answer
    
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 to do 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? –  Anton Egorov Jan 23 '11 at 2:12
    
The solution is do shell script "/usr/local/bin/mvim -c ':cd ~/my/project'" –  Anton Egorov Jan 23 '11 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? –  Anton Egorov Jan 23 '11 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.

share|improve this answer

I'm not sure I understand what you mean, anyway you can try Automator.

share|improve this answer
    
Automator does not work for me –  Anton Egorov Jan 23 '11 at 2:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.