Shared publicly  - 
 
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 Emacs.app
If you want Emacs 24.1 for Mac OS X and don't care about building from sources, download it from http://emacsformacosx.com/ .  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!)
https://developer.apple.com/downloads/index.action?=command%20line%20tools

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 Emacs.app in your Applications folder:
  brew install emacs --cocoa

The formula description is here:
https://github.com/mxcl/homebrew/blob/master/Library/Formula/emacs.rb

Installing Emacs from the Official Sources
Get the official Emacs 24.1 source package:
http://www.gnu.org/software/emacs/#Obtaining

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

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

Disabling Gatekeeper Just for Emacs.app
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 Emacs.app, and leave it enabled to protect the rest of your computer.  Once you have Emacs.app 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 Emacs.app normally.

Where to next?
http://www.gnu.org/software/emacs/tour/
http://jeremy.zawodny.com/emacs/emacs.html
Run the tutorial within Emacs: press control-h, then press t
http://emacswiki.org/
18
2
Miles Pickens's profile photoMohammed Alali's profile photoJeff Fung's profile photoJang Jaehyun's profile photo
8 comments
K Moses
 
Thanks, The Homebrew install works
 
+Keith David Bershatsky Do you mean path completion on the minibuffer? I wasn't aware such a behavior was on by default.  (Tab-tab opens a completion buffer.)  Or do you mean something else?
 
+Keith David Bershatsky Ah, that's weird. Seems like a straight bug to me, the OS should be handling that dialog. Interesting that Aquamacs either figured out the right patch or just doesn't have the issue.
 
Just ran the brew command and it installed successfully but not to the applications folder.
 
Hi, I just installed the Pre-built Emacs.app and can run Emacs.
However I can(t use normally my French (Azerty) keyboard: letters and digits are ok but I can't get symbols like brace antislash ...
Could you advise on why to do?
Thanks in advance
 
Here are 5 commands which will install the latest stable Emacs build on your OSX machine.

$ git clone git://git.savannah.gnu.org/emacs.git
$ cd emacs/
$ ./autogen/copy_autogen
$ ./configure --with-ns
$ make install

All done, no you'll need to copy the created Emacs.app file into your Applications folder. The file is located nextstep/Emacs.app
 
It works fine. I installed Emacs 24.1 on Mac OS X 10.8.3. Now I'm trying to run Lisp code
Add a comment...