Building Emacs 24 for Mac OS X Lion

October 10 2011

hint The information in this post is outdated and kept for archival purposes only!

As of August 2012, you should consider installing the more current autoconf and automake packages from the Homebrew Project, which are current enough to configure the Emacs source without having to use the copy_autogen script. The following will also work, but is only recommended for instances where the correct build tools are not available.

Emacs has included source for building emacs using the Cocoa libraries on OS X for some time now. Unfortunately, the current source requires autoconf version 2.65 or later while OS X Lion ships with version 2.61. As of this writing, the autoconf package available through fink is also not new enough at version 2.63. Attempting to configure from source will result in the following error message: error: Autoconf version 2.65 or higher is required

Fortunately, a workaround is included in the emacs source tree. The included autogen/copy_autogen script can be used to copy pre-generated versions of the files which would be normally generated by autoconf, etc. This is not recommended if the necessary tools are available, but until autoconf is brought up to date it seems like an acceptable work around.

Steps for building Emacs for OS X Lion

Download/Update from the source repository.

If you’re working in an existing codebase which has already been compiled, run make maintainer-clean to ensure that the .elc files are re-compiled.

./configure --with-ns
make install

This last step will create an OS X application at nextstep/, which you can navigate to in finder and click to launch.

If everything works, you can simply drag this application to your Applications folder to install.

See the comments in the source code for more details: autogen/copy_autogen nextstep/INSTALL