Emacs in Client/Server Mode on Mac OS X

Setting up Emacs to run in client/server mode on Mac OS X (Lion) requires a few steps if you want it to be integrated with the GUI.

  1. Download and install Emacs.
    1. Download Emacs from http://emacsformacosx.com/.
    2. Install it by dragging-and-dropping the application to your "Applications" folder.
  2. Set up the server to start upon login.
    1. Open "AppleScript Editor".
    2. Add the following content to the script:
      do shell script "/Applications/Emacs.app/Contents/MacOS/Emacs --daemon"
    3. Save the script, using the "Application" file format, as "Emacs Daemon" in your "Applications" folder.
    4. Close "AppleScript Editor".
    5. Open "System Preferences", "Users & Groups".
    6. On the "Login Items" tab, add the new "Emacs Daemon" application.
    7. Close "System Preferences".
  3. Log out and log in to your account (so that the server starts).
  4. Create an alias so that typing emacs in "Terminal" starts the client.
    1. Open "Terminal".
    2. Open your bash RC script (e.g., ~/.bashrc) in your favourite editor.
    3. Add the following line to the script:
      alias emacs="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c"
    4. Save the script, close the editor, and close "Terminal".
  5. Create an "Automator" application that will allow you to "Open With" the client.
    1. Open "Automator" and select "Application" for the type.
    2. Drag "Run Shell Script" to the workflow.
    3. In the "Pass input" drop-down box, select "as arguments".
    4. Replace the existing contents of the script with the following line:
      /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c "$@"
    5. Save the application as "Emacs Client" in your "Applications" folder.
    6. Close "Automator".
    7. When using "Open With", select the new "Emacs Client" application.
x
Made with Emacs Valid XHTML 1.0 Strict Valid CSS!