Hands on X11by Dan Benjamin
Editor's note--X11 for Mac OS X offers a complete X Window System for running X11-based applications on your Mac. This implementation of X11 includes a window server, libraries, and basic utilities such as xterm. In this article, Dan Benjamin shows you how to install and use the latest beta offered by Apple.
In typical Apple fashion, getting and installing X11 for Mac OS X is a breeze. Just go to the X11 for Mac OS X Download Page and download your copy. It's a big download (41.8MB at the time of this writing); unless you've got a fat Internet connection, consider getting a cup of coffee while you wait.
Once the download is complete, the
file should expand and create an X11 User for Mac OS X folder on your
desktop. Be sure that your system meets the minimum requirements listed in
the Read Me file prior to installation. Then, just double-click the
X11UserForMacOSX.mpkg file inside the folder.
After installing, you can start X11 by launching the X11.app found in the /Applications folder.
The X11 icon will appear in your dock, and an xterm window will appear. An xterm window is a lot like a Terminal window, except with fewer features. It is the window you can use to launch and control your X11 applications by typing commands. There's no reason why you couldn't also use Terminal for this, except that xterm opens with the correct environment variables already set for you. These environment variables are what tells the system where to look for X11 applications, and how and where to display them.
Running Your First X11 App
Apple's X11 software includes more than just an xterm. In fact, it is a full distribution of XFree86 4.2.1, and includes all of the standard X11 programs and utilities. Let's experiment with a few of them, using xterm to launch them. If you're not comfortable working with Mac OS X's command line interface, you might want to read Chris Stone's article, Learning the Terminal in Jaguar.
We'll start with a simple and fun application called "xeyes". To
launch it, just type
xeyes & at the prompt in your xterm
window, and press return. The "&" symbol, when typed after a command,
tells the system to run the program in the background, which returns
control of the xterm back to you (giving you a prompt).
As you'll quickly see, a set of big googly eyes will appear. As you move your mouse, the eyes will follow your cursor around the screen.
Feel free to resize the window, and watch as the eyes grow and change shape smoothly, thanks to Quartz rendering and the Aqua GUI. It's true that xeyes is completely useless, but it's fun. To close xeyes, just like any other Mac OS X app, click the close button in the upper left hand corner.
There are many X11 utilities, all located in the
/usr/X11R6/bin folder (visible only from the xterm or a
Terminal window, not from the Finder). Because X11 sets the xterm's path
variable, you can launch any of these apps right from the xterm command
prompt by typing their name and pressing return. Most of these programs
are not of much interest to the OS X user, as they are geared more toward
the management and tuning of an X11 system (rather than an OS X system).
In upcoming articles, we'll discuss installing and using some useful X11 applications that have been ported to Mac OS X as a part of the Fink project, like Gimp, a popular open-source image editing application.
For now, however, we will focus on the X11's networking and "application sharing" capabilities. In order for these examples to work, you'll need either another Mac OS X system running X11 or a Linux (or some other Unix) system with an X11 distribution already installed. If you don't have one of those other machines available, just follow along.
Pages: 1, 2