You Need to Install X-Windows

From OS X Scientific Computing

Revision as of 02:59, 26 April 2007 by Wgscott (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

X11 vs. Aqua

The Aqua graphical user interface in OS X essentially "replaces" the conventional X-windows based interface characteristic of all unix operating systems. For the casual (non-unix-oriented) user, it provides an aesthetically superior windowing environment, and possesses other advantages as well. Unfortunately, the Aqua interface of OS X lacks the standard functionality required by many multi-platform unix programs, including all of the unix programs that are X-windows based. These programs, which include many scientific applications designed for GNU/Linux, Irix, and so on, expect X11 to be present by default, as well as all the libraries and stuff that comes with X11. These programs require X11 both to compile and to run. Hence by replacing an X-windows based graphical user interface common to all other unix flavors with its own unique interface, Apple essentially crippled its implementation of unix on OS X from the point of view of most third-party unix applications.

This would be a disastrous deal-breaker as far as scientific computing on OS X is concerned, but fortunately a "rootless" version of X-windows has been ported to OS X that permits grafting the conventional unix windowing system onto the Apple platform. This was originally done by third-party developers, but Apple now provides an integrated Quartz-based implementation of X11 in the form of an optional application, called X11.app, that can be installed easily.

Install Apple's X11.app

For that reason, I recommend that the very first thing you do to prepare your OS X computer for scientific computing is to install Apple's X11.app. This is available as an optional package on the OS X installation DVD, or you can dowload it from Apple's website. In addition, you must install the X11 SDK files from the Xcode installation CD or dowload it from Apple's website in order to compile anything that depends upon the X-windows system. The X11 SDK package does not get installed by default on 10.3, but appears to be on 10.4. The installer for Apple's X11.app will install the canonical X11 files into /usr/X11R6 and /etc/X11, and the SDK package will install the required header files into /usr/X11R6/include. The installer for Apple's X11.app will also install a startup utility (the actual X11.app program with the double-clickable X icon) into the directory /Applications/Utilities. (Discard any old ones in /Applications; they don't work.)

Consider having OS X automatically launch the X11.app upon login by adding X11.app to your startup items in your Accounts System Preferences. In order to invoke X-windows based unix programs from the command line in Terminal.app or iTerm.app, you will need to set the DISPLAY environment variable as described below in Section 1.5 on unix shells. There are a few other customizations you might also wish to consider. My shell script GUI Xterminator can help you with that by automating the process and by explaining the various options.