Emacs on Leopard

Every year or so, I go through a similar dance. I’ve upgraded my OS, or replaced a machine, or been generally dissatisfied with my existing Emacs install, and so I begin casting about for a good, GUI version of Emacs to run under OS X. I’ve used Auqamacs and Carbon XEmacs and probably a couple of other precompiled binaries with varying degrees of success, and I’ve compiled my own at least once or twice. Given the size of Emacs, and my relative inexperience with the internals – I have no reason to need to compile my own – I prefer a simple precompiled binary. OS X comes with a command-line only Emacs install, which is certainly usable, but I prefer the GUI version for the colors and fonts.

Having recently replaced the old G5 when it died with a new 24″ iMac, I again this morning found myself in search of an Emacs. I stumbled across Michael O’Brien’s blog post Emacs.app on Mac OS X Leopard, and found exactly what I was looking for. I’ll admit, it took me a couple of minutes to understand exactly what Michael was doing. He starts by downloading the Emacs source distribution, but instead of compiling Emacs, he simply copies Emacs.app from the ./mac folder in the source distribution. What? Emacs source ships with OS X compiled binaries? No, this is where I initially misunderstood.

All OS X application bundles (“.app” files) aren’t really files, they are directories. A .app directory contains not only the actual application binary, but also the icon, a file containing the text for menus, etc, and sometimes other support files for the app. The Emacs.app in the source distribution is the set of files and directories, minus the compiled emacs binary. Once you compile emacs, you can install it as a GUI application, which is where the Emacs.app folder is used.

Instead, Michael copied the Emacs.app folder to the Applications folder, and then created a symlink inside the Emacs.app folder linking to the system emacs that ships with Leopard. This symlink is essentially an alias, and it exists in the same place inside the Emacs.app folder that the compiled binary would go. Instead, there’s an alias, or symlink, so that when OS X tries to run the binary Emacs.app/Contents/MacOS/emacs, it really runs the system Emacs, aka /usr/bin/emacs. And when the system Emacs is launched from inside the Emacs.app, lo and behold, it presents the GUI!

If you are looking for a simple way to run Emacs with the GUI on Leopard, go follow Michael’s instructions. He even offers the Emacs.app folder for direct download, to save both you and GNU some bandwith. One note regarding his instructions: his next to last step, in which you create the symlink, starts with ln -s. You will probably need to prefix this command with sudo like the lines before and after.

Both comments and pings are currently closed.

Comments are closed.