An X11 saga

Yesterday I was in my lounge room editing a file on bigbird, my main FreeBSD machine. Now, bigbird lives in my office upstairs, and I was on the PowerBook, logged in using SSH in the conventional way. I was using GNU Emacs in text mode to do the editing. Now, I like using emacs in text mode, and I do it a lot—often just like that, over a SSH connection from a Windows box in my office at home, or at work. For no apparent reason, though, it occurred to me that OS X was supposed to be able to run an X Windows server and display client windows from programs running on remote hosts. I figured that, largely for the hell of it, I would fire up X Windows and run Emacs in graphics mode. That was about 24 hours ago.

I decided to approach the problem as a Mac user, so I started by looking in the Applications directory for anything resembling an X Windows server. Nothing jumped out at me. Next came Google. Apple's web site certainly seemed to suggest that Tiger shipped with X Windows, so I knew I couldn't be far from the solution. I soon found an article somewhere that suggested that X wasn't installed by default, but that it could be added as a package from the installation media. Now I was moving.

I figured I'd just do a quick Spotlight search on "X11" given my experience with Xcode—this isn't installed by default either, but, on my PowerBook at least, the installer was on the hard disk and I didn't need to use the Tiger DVD. Indeed, I found a likely candidate: X11SDK.pkg. Now, slightly less naive Mac users are probably chuckling already. Yes, that was (not surprisingly) just the software development kit—all the X Windows headers and manual pages for writing X applications. Not what I needed, but no big deal.

Next, I dug up the Tiger DVDs that were shipped with the PowerBook, but which I've never actually used for anything, since the machine had Tiger pre-installed. I fired up the package installer, which got not quite as far as the step where you choose a destination, and promptly died claiming that it was corrupt and unreadable. Great. I polished up the disc a little and tried again, but no joy. Broken installation media. While contemplating how much administrative joy would be involved in getting them replaced, I did what any sensible person would do—started putting the word out with Mac-owning friends that I needed to borrow some Tiger DVDs.

A friend in Sydney pointed out that the package I actually needed was X11User.pkg. The interesting thing here was that I subsequently found that package on my PowerBook, and tried to install it. It failed, claiming that newer software was already installed. Now I was confused. Did I already have the X server installed? I tried it several times. No joy. Further Googling lead me to believe that this error is just implying that the OS itself is too new for the package—it seems an old version of X11User.pkg was shipped on the PowerBook itself. Who knows. By this stage, it was today, and I was already tired of the whole saga.

Eventually, I managed to get hold of the right package from the Tiger installation media. I installed it. From that point on, everything worked as I had originally envisaged:
  • Open an xterm on the PowerBook.
  • SSH to the remote host using the ‘-X’ command line switch.
  • Run an X application.
Nice. My personal saga aside, this kind of thing should demonstrate something to other vendors: X Windows isn't hard. As usual, I'm looking at you, Microsoft. I've run X applications on the Windows desktop before, but all the solutions (that I know of) are clunky and awful. Cygwin and TightVNC, for example, both require that you open an entire X desktop session (yes, window manager and all) in a single, monolithic Windows window. OS X lets you open individual X applications in their own windows on the OS X desktop, and they're essentially indistinguishable from any other application. (Of course, Cygwin and TightVNC are both great products—they certainly beat the nothing that you get from Microsoft in this area.)


Popular Posts