Tired of waiting for emacs to start on OS X? This step by step guide willteach you how to install the latest version of emacs and configure it to startin the background (daemon mode) and use
emacsclient
as your main editor.The Windows/Mac is interesting too. Emacs 25.1 will still run on Windows 9X but not on OS X 10.5 or PowerPC. Emacs 26.3 is a maintenance release. New GPG key for GNU ELPA package signature checking. Emacs 26.2 Released Apr 12, 2019. Emacs 26.2 has a wide variety of new features, including: Emacs modules can now be built outside of the Emacs tree source. Emacs is now compliant with the latest version 11.0 of the Unicode Standard.
Install Homebrew
First you'll need to install the Homebrew package manager if yohaven't already. It is amazing.
Install Cocoa Emacs
Drag the Emacs Application to your Applications folder
Create the daemon application
Open the AppleScript editor and paste the following:
Save this as an Application called 'Emacs Daemon' in your Applications folder
Add as a login item
Goto
System Preferences > Accounts
- With your user name selected, click on the
Login Items
tab - Click on the plus sign
- Browse to your applications folder and find 'Emacs Daemon'
- Don't worry about the 'hide' checkbox, since it the dock icon disappearsnaturally
Create the client application
Open the AppleScript editor and paste the following:
Save this as an Application called 'Emacs Client' in your Applications folder.
Giving the client application a proper icon
Using the Finder, navigate to your Application folder and right click on yourEmacs application (not the client or daemon), and click on
Show Package Contents
Do the same for the Emacs Client applicationCopy the
Emacs.icns
file from Contents/Resources
of the Emacs application tothe Contents/Resources
of the Emacs Client application Delete applet.icns
and rename Emacs.icns
to applet.icns
in the Emacs Client application.Hiding the dock icon for Emacs while Emacs Client is running
Mac Install Emacs
- Again, navigate to your Application folder and right click on your Emacsapplication (not the client or daemon), and click on
Show Package Contents
- Open the
Info.plist
using the Propertly List Editor - Click
Add Child
- Set the key
NSUIElement
- Set the value to
1
This is the setup that I have created to make a daemon-client systemto work with OS X.
Emacs Client.app will start the daemon if it's not running, will spawna frame if there isn't an active one, and will bring the emacs framesto the front if any exist. In short, have Emacs (sort of) emulate normal OS X App conventions.
Macbook Emacs
Further, Emacs Client.app can be used as a droplet. Dragging a fileonto the icon or selecting Emacs Client.app from the 'Open With' menuwill open the file and put it in an active frame if there is one.
The basic building block was from Brian McCallister, and can be foundhere.
This has only been tested on OS X Lion usingEmacs For Mac OS X. In particular, thelocation of Emacs is assumed to be/Applications/Emacs.app/Contents/MacOS/Emacs, and the location ofemacsclient is assumed to be /Applications/Emacs.app/Contents/MacOS/bin/emacsclient.
These paths are very easy to change by modifying the
set emacs_path
and set emacs_client_path
lines.Emacs For Os X Daemon Update
- Configure Emacs Client.app so that right-clicking a file gives EmacsClient as a default option
- Configure Emacs.app so that it won't appear in the Dock, but stilloffers a menu bar. The LSUIElement flag takes away both Dock and menu bar.