This is BrainLog, a blog by Dan Sanderson. Older entries, from October 1999 through September 2010, are preserved for posterity, but are no longer maintained. See the front page and newer entries.

January 26, 2009

Installing Emacs 23 on Mac OS X

Update, July 31, 2009: Emacs 23 is now officially released. These instructions still apply, but the flags have changed slightly since I first wrote this entry. I've updated the text below to apply to the official Emacs 23 release, checked out from CVS.

I've mentioned using the Emacs text editor with Mac OS X several times over the years. Carbon Emacs and Aquamacs are both fine ready-to-run bundles with neat integration with the Mac operating system and visual style. As of Emacs 22, plain ol' GNU Emacs works just fine as a Mac native application (no Terminal or X11 server required). I mentioned how to download and build your own Emacs 22 a while ago, and have since used that post as reference when I needed to remember how.

Emacs 22 has long since been, and still is, the official stable release is no longer the official stable release. Of course, this means the Emacs die-hards have all moved on to Emacs 23, which you can get from GNU's CVS repository as before. Emacs 23 is now the official stable release. You can still get it from the CVS repository and build it yourself for Mac OS X. However, the Mac OS X build instructions have changed slightly since Emacs 22, and if you use my old instructions you get an that complains, "You can't open the application "" because it is not supported on this architecture." So it's time for a new entry.

To build Emacs 23 for Mac OS X:

cvs -z3 co emacs
cd emacs
./configure --with-ns --with-jpeg=no --with-gif=no --with-tiff=no
make bootstrap
make install
sudo cp -r nextstep/ /Applications/


  • To build software, you need to install the XCode developer tools that came with your Mac OS X installation discs.
  • The --with-ns configuration option is required to build a NextStep binary, which is the Mac OS X binary.
  • I've included --with-jpeg=no --with-gif=no --with-tiff=no because my developer tools lack those libraries, yours probably do too, and I'm too lazy to find them and install them. Maybe I'll come back and amend these instructions to include these features someday. (Feel free to post them in comments!) Until then, this Emacs build will lack support for viewing images in these formats.
  • The last sudo cp ... command simply installs into the Applications folder. Notice that it comes from the nextstep directory, not the mac directory.
  • Update July 31, 2009: --enable-carbon-app is no longer necessary.
  • Update July 31, 2009: sudo is no longer required for make install, because the install isn't actually installing, it's just assembling the application bundle in the build directory.

I'm not a part of the Emacs development community so I can't explain these changes, but I'm glad to have found them.

If you don't want to build Emacs yourself, still want to use a vanilla Emacs instead of a bundle, and don't mind getting builds from some guy on the Internet, has easy-to-install downloads for the latest stable version and previous versions of Emacs, as well as nightly CVS snapshots of the development version.


./configure --enable-carbon-app --with-ns --with-jpeg=no --with-gif=no --with-tiff=no
configure: WARNING: Unrecognized options: --enable-carbon-app

I just checked out my emacs from cvs, as instructed above.

Thanks for your post. I believe though that the flag --enable-carbon-app shouldn't be used now with the NeXTSTEP-based port.

Thanks guys. With the official release of Emacs 23, --enable-carbon-app now causes a warning, though it's harmless. I've updated the instructions.

Hi Dan,
Followed the updated instructions, works great. I have a MS Natural 4K keyboard plugged into my mac - the Alt/Windows key didn't work right with emacs(ignored the alt key, and made Windows key the meta). Upgrading to 23 fixed the matter.

What do people normally do to stop e.g. M-q from closing Emacs? Carbon Emacs handles this nicely but version 23 is not available there.

Hi Johan -

By M-q, do you mean Option-q or Apple-q? Option-q is M-q, which is bound to fill-paragraph by default. Apple-q is known as s-q, which (for Mac at least) is bound to save-buffers-kill-emacs in Emacs 23 to replicate the Mac OS X close-app shortcut.

I believe all of the Apple key combos are bindable in Emacs 23 for Mac, but I'm not sure. They all seem to work with the help feature, C-h k s-q, which implies Emacs has full control over its responses to these key combos.

Does that help?

Fantastic! Thanks, I can get to work now.

Just compiled Emacs 23.1 on Mac OS X 10.6 (Snow Leopard), you need to apply a patch. Follow these instructions:

I just tried these instructions under Snow Leopard and got the following error on 'make bootstrap':

/System/Library/Frameworks/AppKit.framework/Headers/NSScroller.h:76: warning: previous declaration of ‘+(CGFloat)scrollerWidth’
nsterm.m: In function ‘-[EmacsScroller setPosition:portion:whole:]’:
nsterm.m:5822: warning: ‘setFloatValue:knobProportion:’ is deprecated (declared at /System/Library/Frameworks/AppKit.framework/Headers/NSScroller.h:107)
nsterm.m:5829: warning: ‘setFloatValue:knobProportion:’ is deprecated (declared at /System/Library/Frameworks/AppKit.framework/Headers/NSScroller.h:107)
nsterm.m: In function ‘-[EmacsScroller mouseDown:]’:
nsterm.m:5934: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘NSScrollerPart’
make[2]: *** [nsterm.o] Error 1
make[1]: *** [src] Error 2
make: *** [bootstrap] Error 2

Has something changed in the emacs trunk?



Patrick: I'm not familiar with that particular issue (I don't pay attention to the code changes) but I wouldn't be surprised, since it's the trunk. Did you try the patch tima mentioned (which may be out of date already, I'm not sure)?

Tried to apply the patch without success. Anyone else have a suggestion for installing on 10.6?

Does anybody know how to enter {}[]\ in emacs23 using a non-english keyboard (swedish in my case)?

In other application it works by pressing Alt-7,8,9 etc. In emacs23 Alt is bound to Meta.

I have tried to set (setq mac-command-modifier 'meta) but Alt is still bound to Meta.

It used to work in emacs22 where the left Alt was meta and the right Alt worked as AltGr (as on a PC keyboard).

Any hints?

(setq mac-option-modifier 'none) fixed the problem with {}\ etc.

This entry is no longer accepting comments. Feel free to contact me if you have a question or a correction. Thanks!