I have to admit, I wasn't completely motivated to jump onto Mac OS X right away. Mac OS 9.1 worked great for me, I had a small fortune invested in Adobe software, and LinuxPPC was working perfectly fine. In the not-so-distant future I knew I needed to dive in and make the migration to Mac OS X. So what was my motivation to make it sooner rather than later? Why, the X Window GUI of course!
XFree86 is an open-source implementation of the X Window System GUI for Unix and Unix-like (Linux, FreeBSD, and Solaris) operating systems. XFree86 is maintained by the XFree86 Project, Inc and is historically intended for x86-based architectures. The current focus of XFree86 is to have its X Window System GUI ported to every platform using a Unix or Unix-like operating system.
XFree86 was available for the Macintosh platform long before the release of Mac OS X. Various flavors existed for MkLinux, LinuxPPC, and FreeBSD for the Macintosh. Although the underlying core architecture of Mac OS X, the Darwin kernel, is FreeBSD based, no X Window server was provided.
A significant programming contribution was made by a familiar name in PC gaming, John Carmack, founder of Id Software. Carmack released an X Window server for Mac OS X in February of 2000, see X Windows on Mac OS X Server -- Initial Port.
Carmack's initial release was intended for the Mac OS X server only. Some work was required for a release to run standalone on Darwin. Torrey Lyon, earlier this year, provided a port of XFree86 that ran natively under Mac OS X's Aqua environment.
The current version of XFree86 is available from Darwinfo web site. A how-to article is also provided for Darwin users to install XFree86 on their Darwin platform. A paragraph is included at the bottom for Mac OS X installation. In my efforts to install X on Mac OS X, I discovered a little more detail than I needed.
As a result, I feel obligated to mention that you should be a little Unix-savvy before you attempt this installation. Unix administrator skills are required and there is always the possibility of hosing your Mac OS X installation if you're not careful.
As of this writing, the semi-current revision of XFree86 for Darwin and Mac OS X is available as a binary package from the Darwinfo site, X11R6-4.01.tar.gz. This is not the latest revision of XFree86. I recommend downloading the XFree86 4.1.0 binaries. The XFree86 FTP server is extremely busy, you may wish to connect and download from XFree86 mirror sites.
|
|
Once you have located an FTP server, go ahead and start downloading files. I created a top-level folder, under Mac OS X, on my hard drive, named tmp_build, where I downloaded the XFree86 4.1.0 files. There are 13 files that are required for the installation.
Xinstall.sh -- The installer scriptextract -- The utility for extracting tarballsXbin.tgz -- X clients/utilities and run-time librariesXlib.tgz -- Some data files required at run-timeXman.tgz -- Manual pagesXdoc.tgz -- XFree86 documentationXfnts.tgz -- Base set of fontsXfenc.tgz -- Base set of font-encoding dataXetc.tgz -- Run-time configuration filesXvar.tgz -- Run-time dataXxserv.tgz -- XFree86 X serverXmod.tgz -- XFree86 X server modulesXquartz -- X components for AquaSome optional files I picked up include:
Xfsrv.tgz -- Font serverXnest.tgz -- Nested X serverXprog.tgz -- X header files, config files, and compile-time libsXprt.tgz -- X Print serverXvfb.tgz -- Virtual frame-buffer X serverXf100.tgz -- 100 DPI fontsXfcyr.tgz -- Cyrillic fontsXfscl.tgz -- Scalable fonts (Speedo and Type1)These two lists comprise all the tarballs required for the XFree86 installation on Mac OS X.
Now it's time to begin. To install XFree86 for Mac OS X, your account will need administrator privileges. If in doubt, the user who set up the Mac OS X at installation is the default administrator. Before you go any further, make sure you know your login alias and that it has administrative privileges.
The FreeBSD Unix-like console is accessible on your Macintosh. Dropping into a console mode is required for the XFree86 installation. From the Mac OS X Apple menu, select "Log Out". Mac OS X will display a login prompt as shown in Figure 2. To access the FreeBSD console type >console in the name field of the login window and hit return (or use the Log In button).
|
You will see a text prompt displaying the following information.
Darwin/BSD (localhost) (console)
login:
Type in the alias (account name) for the Mac OS X administrator and password as you would do when logging into Mac OS X. If your login is successful, you will see the following command line.
[localhost:~] youraliasname%
Once you're in the console mode you're ready to run the XFree86 install script. Do you recall a time when a Mac user wouldn't even think of displaying a flashing prompt on their display? The Macintosh world has certainly changed.
When I first entered console mode, my initial operative was to grab root access using the su command. An interesting dilemma surfaced. I never set a root password and my Mac OS X administrator password didn't work for root. Frankly, this is the least eloquent way of performing the install and certainly more dangerous if anything should go wrong. I next tried the sudo (superuser do) command and access was granted to my administrator user alias. The sudo command allows the administrator to execute commands as root user. This access is required for the XFree86 install. The sudo command is invoked as follows:
[localhost:~] youraliasname% sudo root
Password:
[localhost:~] youraliasname%
Just hit the Return key when prompted for the root password. You are now operating in sudo mode. You're ready to install XFree86.
|
Your current directory is your home directory, /Users/youraliasname. To run the Xinstall script, you need to be in the tmp_build directory you downloaded your files into earlier. If you created the directory as a top-level directory in your hard drive, as I did, you need to change directories in the following manner,
[localhost:~] youraliasname% cd /
[localhost:/] youraliasname% cd tmp_build
[localhost:/tmp_build] youraliasname%
Before you embark on running the Xinstall script, you should make a quick check of the files downloaded in the tmp_build directory. This will determine if the correct binaries are there. Invoke the command (remember as sudo) sh Xinstall.sh –check.
[localhost:/tmp_build] youraliasname% sh Xinstall.sh
–check
uname reports 'Darwin' version '1.3.7', architecture
'Power Macintosh'.
Binary distribution name is 'Darwin-ppc'
[localhost:/tmp_build] youraliasname%
If you get a clean bill of health from the simple sanity check, you're ready for the XFree86 installation. Go ahead and install the XFree86 binaries.
[localhost:/tmp_build] youraliasname% sh Xinstall.sh
This may take a moment or two to execute. Once completed, you're ready to execute the X Window environment.
If the XFree86 install failed, it may be because you didn't have root user privileges. A good indication of this is a message referring to directories, such as /usr/X11R6, "not found." Go back and make sure you are granted root privileges with the sudo command.
At this point in the installation, your Xinstall.sh script has executed properly and you're ready to run XFree86. There are a few housekeeping items we need to take care of first. Let's go ahead and set the environment variables for the X Window environment.
Mac OS X's Darwin kernel uses the tcsh interactive login shell as default for user login. You will need to create a resource file to provide the proper path and environment settings for XFree86.
[localhost:~] youraliasname% echo $SHELL
/bin/tcsh
[localhost:~] youraliasname%
Using your vi editor, create a .tcshrc resource file for your account login. The file must be created in your user home directory.
[localhost:~] youraliasname% cd
[localhost:~] youraliasname% vi .tcshrc
set path=($path /usr/X11R6/bin)
~
~
~
:wq
[localhost:~] youraliasname%
To invoke the changes to your .tcshrc file, you will need to source the file.
[localhost:~] youraliasname% source .tcshrc
Torrey's web page, XonX, recommends that you add a path file in the ~/Library/init/tcsh directory. If you created a .tcshrc file, you don't need to do this. However, if you're a pragmatic and want to stick to specs, you will need to create the directories, /init/tcsh under your ~/Library directory.
[localhost:~] youraliasname% cd ~/Library
[localhost:~/Library] youraliasname% mkdir init
[localhost:~/Library] youraliasname% cd init
[localhost:~/Library/init] youraliasname% mkdir tcsh
[localhost:~/Library/init] youraliasname% cd tcsh
[localhost:~/Library/init/tcsh] youraliasname%
Create the file named path using vi (or any other editor you can muster up).
[localhost:~/Library/init/tcsh] youraliasname% vi path
setenv PATH "${PATH}:/usr/X11R6/bin"
Veteran XFree86 installers will probably have a desire to run Xconfigurator. This is not required on Mac OS X and Darwin. All this information is passed in from the IOKit.
Okay, you've waited long enough. Fire up the X Windows!
[localhost:~] youraliasname% startx
Doesn't that bring tears to your eyes? Isn't that a beautiful sight? The X Window environment running native on a Macintosh!
|
Related article: X on X -- Because Mac OS X is based on Darwin, it's possible to shut down Core Graphics and install XFree86 to access your X11-based programs. Here's one BSD user's experience. |
The X Window environment for Mac OS X is still leaning on the side of bleeding-edge technology, and there are a few caveats. A primary issue at the moment is that X doesn't shut down gracefully on Mac OS X. There is a workaround at the present time and that is to exit all the open windows and terminals before shutting down X. You will then see the spinning, psychedelic beach ball. Although there is no command line for this, type the command logout. You will then be returned immediately to the Mac OS X login window.
For the grand finale, we're going to run the X Window System side-by-side with Mac OS X. Yes, you read correctly! Under the Mac OS X environment, open your Applications folder. You will see that the Xinstall.sh script left you a little present. Do you see the XDarwin application? It's the one with the big, red, gleaming X icon.
|
Double-click the XDarwin.app icon to launch the X Window environment.
|
Now is that a beautiful sight or what? The X Window environment and Mac OS X running side-by-side. You can toggle between environments using the Command-Option-A key sequence.
If you're just as excited as I am about this new technology, I recommend you check out a few sites on the Net.
You should start with the Darwinfo ports web page. This URL will provide you with Mosaic, AfterStep, and Doom ports. If you're looking for that special X utility, stepwise.com is also a good place to start your search. Who knows? Before long we'll probably have software distribution CDs for OS X crammed with X goodies.
Michael J. Norton is a software engineer at Cisco Systems.
Return to the Mac DevCenter.
Copyright © 2009 O'Reilly Media, Inc.