OSX, X11, and Emacs

A holy grail decision for me to move to OSX was the rumored ability to run X11 apps (Emacs, for example) in the native OSX windowing environment. I’ve heard rumors from a few people who got it to work, but I never have actually seen it running…until today…

There were a couple of steps to get this to work, so let me point them out in case it helps anyone out.

  1. The first step is to install X11. I’m very happy with Apple’s X11. When you do the download, make sure to grab not only the large dist that they shove down your throat when you click on the shiny button, but also the X11 SDK which is linked at the bottom right of the download page. You’ll need to install both of them to install the Fink emacs package. Once X11 is installed you can start it up and get an XTerm right off the bat.
  2. Speaking of Fink, if you don’t already have it go and get it now. It’s pretty easy to set up and the FinkCommander tool puts the best interface onto Debian package management that I’ve seen. Fink is the gateway to all of those great Unix tools you’re looking for.
  3. Once you’ve got Fink installed and functioning, grab the emacs package. There are several to choose from, multiple derivatives of emacs20, emacs21, and xemacs. I still use emacs20, but emacs21 is supposed to work well too. I’ve heard of a few issues with xemacs but I haven’t tried it out. When you install the appropriate X-enabled emacs package then it will grab a few other xserver-related Fink packages as well (this is why you had to install the X11 SDK from Apple).
  4. The final configuration point for me was to incorporate my .Xresources file. This is how I set the default fonts and colors for Emacs and XTerm, and since I CVS distribute my dotfiles to several different machines I want to use the same process on each. xrdb (the program which merges in Xresources) needs the cpp tool though (C pre-processor used to #include header files). There wasn’t a basic package for it in Fink, so I went ahead and installed the OSX Developer Toolkit to get gcc and cpp (I was going to do so at a later time). Halfway through downloading the 300 meg toolkit from developer.apple.com, I found it already hiding on my HD under Applications::Installers. Now the full package install can take up to a Gig, but you really only have to install the Developer Tools (first selection when you “Customize” what to install). That’s only about a hundred megs.

When all this is done, “things just worked”. The X11 app automatically recognized and loaded the .Xresources file in my home dir, XTerm popped up, and Emacs launched right from that. I didn’t have to make any configuration changes, and it works a heckuva lot better than the old Windows Emacs port (which didn’t know about Xresources). LOVE IT!

You don’t have to do the last step if you don’t care about your Xresources getting merged in, and maybe someone’s come up with a lighter-weight way to get cpp installed on your system, but if you’re installing Emacs then you probably want a compiler as well.

3 Comments so far

  1. Payam Mirrashidi on June 6th, 2003

    There is a Carbon port of emacs to Mac OS X. No need to run X just for emacs.

    http://packages.opendarwin.org/Applications/emacs-21.3.50.1+carbon.dmg

  2. Rand on June 6th, 2003

    Thanks Payam! That’s great to know. I guess this might be reason to push me to Emacs21. In the process I’ve also started to explore WebDav, .Mac, Safari, and the Carbon/Cocoa relationship.

    And don’t worry, I’ve got plenty of reason to have a fully functionaly X server running on the laptop. =)

  3. John P on February 25th, 2004

    it looks like they have changed the way to get the X11 SDK as of Panther. Anyone find a download for it? Appears that you have to have the Panther Developer CD to get it.

Leave a reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word