How to Install Emacs 24.1 on Mac OS X 10.8 Mountain Lion

The second-most popular article on my old blog is the one about installing GNU Emacs on Mac OS X.  I update this article periodically, but now that I'm doing my short-form blogging on G+, I thought I'd post this here, too.  For brevity, I'll assume you know what Emacs 24.1 is and why you would want it.  OS X 10.8 Mountain Lion includes a small non-windowed version of Emacs 22.1, but it's easy to get a beautiful modern version of Emacs as an OS X application.

Downloading a Pre-built
If you want Emacs 24.1 for Mac OS X and don't care about building from sources, download it from .  You get a clean build of the latest version from good samaritan David Caldwell.

Skip to the bottom of this post for a note about OS X 10.8's new Gatekeeper feature, which will prevent you from running this right away.

Installing the Command-Line Build Tools
To build Emacs yourself using official sources, you need command-line software build tools.  You can get these tools for free from Apple.  One way to get them is via Xcode, the tools Apple gives away for developing OS X and iOS software.  Open the App Store, then locate and install Xcode.  After the installation is complete, open Xcode, select the Xcode menu, Preferences, then select the Downloads tab.  Find the "Command Line Tools" line and click the Install button.  You must sign in with or register for a free Apple developer account.  Once installed, you'll have a set of command-line tools, including "gcc" and others, available on the command path (e.g. /usr/bin/gcc).

You can also get the Command Line Tools directly from Apple's developer website without installing Xcode.  However, the latest version, "Command Line Tools for Xcode - Late July 2012," only works with Mac OS X 10.7 Lion, not OS X 10.8 Mountain Lion.  As far as I can tell, today, Mountain Lion users must install this via Xcode 4.4.  Perhaps a 10.8 version of the self-contained Command Line Tools package will be on Apple's website soon.  (Many thanks to Apple dev support for making this available!)

Installing Emacs via Homebrew
If you like Homebrew, there is an "emacs" formula that performs all of the remaining steps, and it knows to use Emacs 24.1.  I haven't tried it yet (someone confirm and I'll update), but I believe this command downloads, builds, and installs in your Applications folder:
  brew install emacs --cocoa

The formula description is here:

Installing Emacs from the Official Sources
Get the official Emacs 24.1 source package:

Unpack it to create the emacs-24.1 directory.  Then run these commands in Terminal:
  cd emacs-24.1
  ./configure --with-ns
  make install

Your is now in emacs-24.1/nextstep/  Locate this in Finder, then drag it to your Applications folder.

Disabling Gatekeeper Just for
OS X 10.8 introduces a new security feature, called "Gatekeeper," that by default will prevent software built by an "unidentified developer" from running on your computer.  You must disable this security feature to run Emacs 24.1 installed via the methods described here.

Thankfully, you can disable Gatekeeper for just, and leave it enabled to protect the rest of your computer.  Once you have installed, control-click on the icon, then select Open.  In a few seconds, it will prompt you to confirm you are opening an app built without a developer ID.  Click "Open."  From now on, you can open normally.

Where to next?
Run the tutorial within Emacs: press control-h, then press t
Shared publiclyView activity