I created a Mac App launcher for Emacs installed via Homebrew. The technique uses Automator.
The problem with Automator is that a spinning gear goes into the taskbar each time. I'd rather not have to close it every time I start Emacs!
Using Emacs.app from the Dock Create an app that runs a shell script that runs Emacs.app, like this: use Finder to navigate to /Applications and double-click Automator.app. Select the document type “Application” and click “Choose”. In the list on the left, select “Library”. In the next list, find “Run Shell Script” and drag it into the workflow area on the right. In the new shell script, delete the text and replace it with:
cd # Start in my home directory.
Use my environment: echo '/Applications/Emacs.app/Contents/MacOS/Emacs "$@"' | bash --login -s
"$@" Select “Shell: /bin/bash” and “Pass input: as arguments”. Click “File > Save…” and choose a name and location for your new app. For example, you might choose the /Applications directory and name the app “Emacs for Dock.” Don’t replace Emacs.app.
If you like, you can change your new app’s icon to match Emacs.app, like this: select Emacs.app and right-click “Get Info” or press cmd+i. In the info window, select the small icon in the top left corner and copy it (cmd+c). Next, select your new application, get its info, select the small icon and paste (cmd+v).
Drag your new app into the Dock as usual, and you’re good to go.
Your new app does two things that the Dock doesn’t (on Mac OS 10.9). The “cd” command causes emacs to start in your home directory, instead of the root directory “/”. The --login option gives emacs the same environment as an interactive Terminal. In particular, it gives emacs your usual PATH environment variable, so you can run commands in emacs the same as commands in Terminal. An alternative to --login is -i, which sets the environment differently, as described in the
#!/bin/sh
Line 3:osascript -e 'tell application "/Users/HOME/.0.data/.0.emacs/Emacs_10_01_2014.app/Contents/MacOS/Emacs" to activate'
I did this to achieve workaround for a rare bug that affected my dock becoming unhidden on Snow Leopard.brew linkapps
?