Installing Emacs on OS X

From WikEmacs
Revision as of 17:19, 28 September 2012 by 184.76.34.40 (talk) (Update installation information, adding instructions for MacPorts with Emacs 24.)
Jump to navigation Jump to search

OSX comes with a preinstalled version of Emacs, but alas it the oudated Emacs 22. Obtaining a newer Emacs on OS X is really simple. There are several popular ways to do it.

Emacs 24

As a binary package

Simply download a binary from Emacs for OSX

MacPorts

If you have MacPorts installed, you can just do:

$ port install emacs

to install Emacs 24. The MacPorts installer updates your PATH environment variable, so the MacPorts build of Emacs should be found by your shell before the (outdated) build that comes with Mac OS when you type 'emacs'. If you prefer the Emacs.app build, that's available by executing:

$ port install emacs-app

Homebrew

Emacs 24 is also available via homebrew. Just type the following incantation in your shell and you’re done:

$ brew update
$ brew install emacs --cocoa
$ ln -s /usr/local/Cellar/emacs/24.2/Emacs.app /Applications
or
$ cp -r /usr/local/Cellar/emacs/24.2/Emacs.app /Applications/

The second step is optional, but it’s recommended if you like to start Emacs from the launchpad or from Spotlight.

Chances are good you have an older version of Emacs installed by default with OS X. It's suggested you to remove that older Emacs version to avoid conflicts with the new one. Do this:

$ sudo rm /usr/bin/emacs
$ sudo rm -rf /usr/share/emacs

Or just create an alias in your shell and when you invoke 'emacs' it will run the newly installed version:

$ alias emacs="/usr/local/Cellar/emacs/24.1/Emacs.app/Contents/MacOS/Emacs -nw"

To make it permanent, if using bash, add that line to ~/.bash_profile.

That’s all folk! You may now proceed to the configuration section.

Emacs 23

As a binary package

Simply download a binary from Emacs for OSX.

Use a package manager (Emacs 23 only at time of writing)

  • Fink
  • MacPorts
port install emacs

You can add +<variant> [+<variant>...] where variant is one or more of:

  • dbus: Builds emacs with D-Bus support
  • gtk: Builds emacs as an X11 program with GTK+2 widgets
  • motif: Builds emacs as an X11 program with Motif
  • universal: Build for multiple architectures
  • x11: Builds emacs as a X11 program with Lucid widgets

The gtk, motif and x11 variants require (depend on) MacPorts' X11 libraries. They're mutually exclusive.

Aquamacs

A near-OS-X-native port of GNU Emacs, integrating Emacs with all the features of Mac OS X.