In this article I’ll share with you a few tips and tricks about running Emacs under the Max OS X operating system. This article will focus on the vanilla GNU Emacs, but if you want a more native OS X experience you might have a look at the enhanced Emacs Mac port.
I always run the latest development version and I use homebrew to install it:
$ brew install emacs --HEAD --with-cocoa
Keep in mind there’s an ancient Emacs 22 that ships with OS X. You
might want to alter your
PATH, so that the new Emacs is picked up in
Alternatively you can just create an alias in your shell and when you
emacs it will run the newly installed version:
$ alias emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"
If you installed via Homebrew that path might look like this:
$ alias emacs="/usr/local/Cellar/emacs/24.5/Emacs.app/Contents/MacOS/Emacs -nw"
To make it permanent, if using bash, add that line to
~/.bash_profile. zsh users will want to update
In case you’re wondering -
nw tells Emacs to start in “terminal”
mode (instead of in GUI mode).
I heartily recommend you to remap your Caps Lock key to Control. This
can be easily done via Preferences -> Keyboard -> Modifier Keys. If
you’re using a laptop keyboard or the bluetooth keyboard you
might want to remap your right
Option key to
well. No one can use effectively Emacs without a right Control
key. Remapping it is a bit more involved and requires the use of the
If you’re adventurous you might even try a crazier idea.
Setting the PATH variable
Long story short - if you’re running Emacs from Spotlight (or any
other launcher for that matter) your
won’t be same as the ones in your shell (and that’s every nasty since
you want be able to run some external programs from Emacs). The best
way to handle this would be installing the package
by Steve Purcell.
For flyspell to work correctly you’ll need to install aspell plus a few dictionaries.
$ brew install aspell --lang=en
OS X ships with BSD’s
ls command which doesn’t have all the features
ls (used internally by
dired). Fortunately, this is easily solvable:
$ brew install coreutils
To avoid conflicts the GNU utils are prefixed with
(setq insert-directory-program (executable-find "gls"))
Dash is the ultimately API documentation browser. I can’t live without it!
If you’re using it as well, you might want to install dash-at-point.
If you want to spare yourself part of the headache of configuring Emacs on OSX and get a lot of extra firepower you might want to install Emacs Prelude - an enhanced Emacs 24.x configuration (developed by yours truly) that should make your experience with Emacs both more pleasant and more powerful.
P.S. I’d like to hear your tips & suggestions about making the Emacs experience on OS X nicer and more powerful!