Difference between revisions of "Installing Emacs on OS X"

From WikEmacs
Jump to navigation Jump to search
(Revise section on Emacs 23 (no longer available in MacPorts) and elaborate on information on Aquamacs. Minor typo fixes 'n stuff.)
(Reflect the fact that you'll probably be running port through sudo.)
Line 12: Line 12:
  
 
<source lang="bash">
 
<source lang="bash">
$ port install emacs
+
$ sudo port install emacs
 
</source>
 
</source>
  
Line 18: Line 18:
  
 
<source lang="bash">
 
<source lang="bash">
$ port install emacs-app
+
$ sudo port install emacs-app
 
</source>
 
</source>
  

Revision as of 18:43, 30 September 2012

OS X comes with a preinstalled version of Emacs, but alas it is the outdated Emacs 22. Fortunately, obtaining a newer release 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:

$ sudo 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:

$ sudo 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

Binaries for Emacs 23 are still available from Emacs for OSX.

Aquamacs

A near-OS-X-native port of GNU Emacs, integrating Emacs with all the features of Mac OS X. Available here. As of this writing, the latest version (2.4) is based on Emacs 23.3. Comes bundled with some handy packages like AUCTeX.