HOWTO (Build and) Install Carbon XEmacs on OS X

Update: added instructions for installing elisp packages after building.

There are as many Emacsen as there are grains of sand in the desert. For various reason (largely habit) I prefer XEmacs to Emacs, when given a choice- even when in text mode (xemacs -nw for the uninitiated; I usually alias this to emacs). And while I love a good command prompt as much as the next geek, I do own a Mac, and sometimes I want a more Mac-like experience.

Carbon XEmacs is a derivative of XEmacs, developed by Andrew Choi. Carbon XEmacs does not require X11, but instead uses the OS X Carbon libraries for its GUI display. Of the various OS X-specific Emacsen I have tried, it is my current favorite. At the time of this writing, the current version of Carbon XEmacs is Beta 4, and is available as a series of patches against the XEmacs source. This HOWTO describes how to build Carbon XEmacs Beta 4 for Mac OS X 10.4.4, and attempts to describe more generally how to build the latest Carbon XEmacs for any OS X 10.3+. Since many Mac users (myself included) are spoiled by the many binary packages and package managers (such as Fink and Darwin Ports) available for OS X, this HOWTO goes into some detail about how to download, patch, and build the source. If you already know this stuff, feel free to skim.

(If you’ve never done so before, you’ll need to install the XCode developer tools from your OS X install CD/DVD. If you’ve lost these, it’s available from Apple’s Developer site. It’s basically a click-and-forget installer package.)

Let’s do this

To begin, you will need to download the XEmacs source for the same XEmacs version that your Carbon XEmacs patches apply to. At the time of the writing, the latest Carbon XEmacs is Beta 4, which is supplied as a diff (set of patches) to xemacs-21.5.23. Visit the download page to locate a suitable mirror, and download the source package for the correct version. As of this writing, all 21.5.x releases are considered Beta releases of XEmacs, so I chose the beta download page, and a local mirror therein.

When you arrive at the mirror, it will be a directory on an FTP server, full of files. look for a tarball- a file ending with .tar.gz– matching the xemacs version you need. In this case, I’ll be downloading xemacs-21.5.23.tar.gz. You will also see files with similar names ending in .patch.gz, .asc, and .md5. You will not need these (unless you need them- in which case you already know you need them. The rest of us will soldier on).

After downloading the file, open Terminal and change to the directory where the .tar.gz file was downloaded. I downloaded mine to my ~/ext directory:

cd ~/ext

If you don’t know where your downloads go, they probably go to your desktop; try cd ~/Desktop (capitalization counts). Now we’ll extract the source code:

tar xzf xemacs-21.5.23.tar.gz

Download the diff file from the Carbon XEmacs page to the same directory where you downloaded the xemacs source. Uncompress the diff file:

bunzip2 xemacs-21.5.23-carbon-b4.diff.bz2

And patch the original sources:

patch -p0 < xemacs-21.5.23-carbon-b4.diff

An aside: this is some pretty cool stuff if you’re not familiar with diffing and patching; the diff file is just a list of the changes between the original and Andrew Choi’s version, patch applies these changes to our original files, resulting in files that match Choi’s modified source. For the curious, -p0 (essentially) tells patch that it doesn’t have to adjust the paths; that’s why we made sure we put the patch in the same directory as the original zipped sources.

Now, time to make the donuts, er, software:

cd xemacs-21.5.23/carbon

And now, the waiting. The hardest part, if we are to believe Tom Petty. This will take a while. On my 1.8 GHz iMac G5 (1.5GB RAM), it took around 7 minutes or so; it would probably take twice as long on my old G4 Powerbook.

When it’s done, you’ll have a shiny new in the current directory (carbon). Unfortunately, your shiny new doesn’t do a whole lot- none of the lisp packages that provide a significant portion of XEmacs’ features are included in the source code package. Instead, you’ll need to download them separately. The easiest way is to download the “xemacs-sumo” package, which contains all of the official packages in a single download. For multibyte character set support, you’ll also want the “xemacs-mule-sumo” package (mule is the emacs/xemacs multibyte subsystem).

From the download page, find the link to download Official Packages, and select a mirror. You’ll end up in an FTP directory, as before. Download the following packages into the same directory as your other downloads:


The packages can live a couple of different location, but I prefer to keep the packages directly inside the application bundle. To unpack the tarballs to the right place run the following (remember to change the path if your downloads aren’t in ~/ext):

cd ~/ext/xemacs-21.5.23/carbon/
tar xzf ~/ext/xemacs-sumo.tar.gz 
tar xzf ~/ext/xemacs-mule-sumo.tar.gz

Your is now fully loaded. To move this to your Application directory, you can drag-n-drop in Finder, or just:

cd ~/ext/xemacs-21.5.23/carbon
mv /Applications/

Just double click the teddybear icon to launch. If you want to see it run in a terminal window, use this (assuming you moved it to your Applications folder):

/Applications/ -nw

As additional (Carbon) patches against the same base version of xemacs are released, you can download and apply them in the same manner, so keep the directory around. Remember to re-build the app (and copy it to Applications) after each patching. If a new patch-bundle is release against a newer XEmacs version, just dump the old source code directory and start over from the top.

Both comments and pings are currently closed.

5 Responses to “HOWTO (Build and) Install Carbon XEmacs on OS X”

  1. Yeager Says:

    Very cool! Soon I will have a sweet sweet Mac with which I can do this…


  2. jb Says:

    Great, but…<br/>

    Good recipe! Took me all of about 15 minutes. BUT, problems I notice right away (compared to X11 XEmacs, which had its own mule problems) is the lack of font support, broken syntax highlighting and, , inability to find my sitelisp dir ((add-to-list ‘load-path (expand-file-name “/Users/jb/.xemacs/lisp”)).

  3. metaperl Says:

    Thank you very much for this accurate summary. I did with wit 21.5.26 with no probs.

  4. eg_puzzle Says:

    I installed 21.5.27 with no problems. Although it will become obvious during the installation, the latest diff file will most likely be a zip file, and hence the user will need to use unzip instead of bunzip2.

    Thank you.

  5. noid499 Says:

    Worked for me too with 21.5.28. Thanks!