macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Installing XFree86 on Mac OS X
Pages: 1, 2

Running Xinstall

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%

A quick sanity check

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.

A note before we move on...

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.

Running XFree86

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.

The .tcshrc file

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

Environment variables using the X documentation

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"

The moment you've been waiting for

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.

Caveats of XFree86 4.1.0 and Mac OS X

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.

Running X on X

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.

Screen shot.
Figure 2. X-windows can be launched from the Mac OS X Applications folder.

Double-click the XDarwin.app icon to launch the X Window environment.

Screenshot.
Figure 3. The X Window environment runs concurrently on the Mac OS X desktop.

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.

X unleashed!

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.