In this article I’ll share with you a few tips and tricks about running Emacs under the Max OSX operating system.
Installation via Homebrew is also a decent option, although it more time consuming.
After the installation you might want to wipe out the ancient Emacs 22 that ships with OSX by default(its presence will only cause headaches, trust me):
Keep in mind that the OSX updates will (unfortunately) bring Emacs 22 back from the dead, so
you might consider altering your
Alternatively you can just create an alias in your shell and when you
emacs it will run the newly installed version:
If you installed via Homebrew that path might look like this:
To make it permanent, if using bash, add that line to
~/.bash_profile. zsh users will want to update
The Homebrew Emacs formula includes a patch providing the
ns-toggle-fullscreen command for switching between normal and
full-screen modes. It works well, but does not provide the typical OS
X Lion full-screen app experience. In particular, it remains on the
desktop, obscuring non-full-screen applications, rather than moving to
its own space. For OSX Lion style fullscreen support have a look at
Another option that you might want to explore is the maximizer utility that brings full-screen support for all Cocoa apps under Lion.
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’ll definitely want to remap your right Option key to Control as 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 third-party utility KeyRemap4MacBook.
On a regular Mac keyboard you’ll probably want to map Command to Meta
and Option to Super. On an external Windows keyboard you’ll want to
map Command to Super and Option to Meta (on Windows keyboard the
Command and Option keys are swapped). Add this to your
If you often switch between your laptop keyboard and an external
Windows keyboard (like me) you might want to define this helper
command and bind it to some key combo (
C-c w in the example):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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.
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.