How to launch GUI Emacs from command line in OSX?
command-line, emacs, macos
Solution
Call the following script "emacs" and put it in your `PATH` somewhere:
#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"
That covers #2, #3, and #4.
For #1, put this somewhere in your .emacs file:
(x-focus-frame nil)
The emacsformacosx.com site now has a How-To page, which is where the top snippet came from. There's more info there about running `emacsclient` and hooking Emacs up to `git mergetool`.
Problem
How do I launch GUI Emacs from the command line in OSX? I have downloaded and installed Emacs from http://emacsformacosx.com/. I'll accept an answer fulfilling all of the following criteria: - The emacs window opens in front of my terminal window. - Typing "emacs" launches a GUI Emacs window. Finding files in that window will default to looking in the directory from where I started Emacs. - Typing "emacs foo.txt" when foo.txt exists launches a GUI Emacs window with foo.txt loaded. - Typing "emacs foo.txt" when foo.txt does not exist launches a GUI Emacs window with an empty text buffer named "foo.txt". Doing ^X^S in that buffer will save foo.txt in the directory from where I started Emacs.