Emacs on the Mac (Life has a funny way of sneaking up on you)

5 minute read

I’ve been using Emacs for more than 20 years now. I still use it just about everyday on servers I admin. However, a year or so ago I started using TextMate as my day to day editor for development on the Mac. TextMate has some nice features: a very usable project mode, code snippets, variable completion (Emacs has these as well, but that’s another post), and it’s what all of the cool kids were using.

Now all of a sudden Emacs is cool again. And isn’t it ironic…dontcha think?

So, I’m going to give Emacs on the Mac another shot. Not (just) to be cool, but because I can’t so much as type this post without trying to use Emacs key strokes that may not be there (curse you Wordpress for taking my Control-A!).

In the future I plan to look for Emacs equivalents for TextMate features I’ll miss. But the first question I need to answer is “Which Emacs to use?” There are a number of options, all with pluses and minuses. Since I couldn’t find much in the way of comparisons, I thought I’d better review them myself. I’ve limited this to native OS X ports of GNU Emacs. There also exists XEmacs, a major fork of GNU Emacs with Mac support but I’m not an XEmacs user. And it’s possible to run X Windows versions of Emacs under OS X, but if that’s your thing, you don’t need my help setting it up.

The EmacsWiki offers a lot of Mac Options, but it really boils down to three choices: Aquamacs, Carbon Emacs, and Emacs.App. These native versions of Emacs do have a lot in common. They:

  • Are GUI based. (You may have only seen console versions of Emacs but it's had a GUI for at least 15 years.)
  • Support common Command/Apple key bindings, so you can save files with Command-S instead of C-x C-s, open files with Command-O, cut and paste with Command-C and Command-V, and so on.
  • Are integrated with the system cut buffer; if you copy, or kill (cut) text in using Emacs commands, it will be available to paste in other applications. Likewise, text copied or cut in other applications can be pasted into Emacs using it's yank (paste) commands.
  • Follow the X-Windows style of copy on select, paste on middle-button

Aquamacs

Aquamacs is the most Mac like Emacs of the bunch. The Aquamacs developers strive to give Emacs a Mac feel. It features customizations such as a Mac-style tool bar, user friendly menus, and, in the 1.6 preview version, tabbed buffers. When using the Command/Apple keys to open or save files it uses the standard file dialogs. The distribution also includes a large number of add-on editing modes and packages, many of which have been pre-configured.

One oddity is it’s printing support, it sends the buffer to Preview for printing.

If you are new to the Emacs, then Aquamacs is probably the place to start. However, if you’ve used Emacs previously you may find that some Emacs-ness has been lost, and if you plan to use Emacs on other platforms you may find some of the differences confusing.

Download Aquamacs Aquamacs FAQ

Carbon Emacs

Interestingly, while not the official version, out of the box Carbon Emacs is Emacs to a fault; by default standard Mac key-binding are not enabled and the Command/Apple key is the meta-key. This is, in fact, the version of Emacs that ships with OS X 10.5 Leopard and is installed in “/usr/bin/emacs”. Apple does not include the .app wrapper so it only runs in the command line. In theory you could download and install just the wrapper, but it’s much easier to grab the full version from Apple

To make it more Mac like add:

(mac-key-mode 1)
(setq mac-option-modifier 'meta)

to your .emacs.el which will enable the standard Command/Apple key bindings and make the Alt/Option key the meta key. Thus configured it strikes a good balance between being Emacs and being a Mac application.

Like Aquamacs, Carbon Emacs ships with additional pre-configured editing modes and packages. Unlike Aquamacs it doesn’t add much in the way of Mac-ish features. It also has the best printing support, being the only one of the three to use the native print dialog. Carbon Emacs is actively developed, but, because of the time needed to integrate it’s changes, it may lag a bit behind the official version.

Carbon Emacs is a good choice for people who want a “standard” Emacs with a Mac feel to it and a good collection of pre-configured add-ons.

Download Carbon Emacs Carbon Homepage

Emacs.App

Emacs.App (or EmacsApp) is the official version of Gnu Emacs for the Mac. It’s based on the NeXTstep / OpenStep / Cocoa API and is very similar in look and feel to Carbon Emacs. Naturally it only includes the standard packages and modes that come with official versions of Emacs.

The major downside is that Emacs.App is not in the current stable Emacs release (22.3). It will be included in Emacs 23, due (or predicted for) later in 2009, but until then it only available in the developer “edge” version through CVS. This creates a further issue in that, while there are binary distributions available they tend to be out of date, so you’ll have to build it from source. Fortunately this is very straight forward:

cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co emacs
cd emacs
./configure --with-ns
make
make install
cp nextstep/Emacs.app /Applications

(The “make install” step builds the .app wrapper, it doesn’t actually install anything.)

Emacs.app is also available from MacPorts and Fink.

When all is said and done Emacs.App is Emacs; if you want to be be up to date with the current version, then this is the one to use. However, you will need to install, configure, and maintain any additional modes and packages you want to use.

Emacs.app at the EmacsWiki

In short, choose Aquamacs if you want a more Mac-Like Emacs. For the Emacs experience with less effort, use Carbon Emacs. For the most current Emacs, with all of the risks and rewards of using edge software, plus a little more work, use Emacs.App.

Myself, I’m going to go with Emacs.App. It’s closest to the versions I use on my servers, willing to beta-test, and I’m comfortable installing and configuring additional packages.

Comments