OroborOSX

More than just another window manager!
A complete environment for X11 on Mac OS X


About
OroborOSX
Version
History
Download |
|
Troubleshooting E-mail lists
and forums
|
|
Introduction to
X11 on OSX
About
XDarwin
XDarwin
forums
|
|
About
Oroborus

An Introduction to X11 on OS X

What is XFree86?

What is XDarwin?

What is Darwin, and how is it different to XDarwin?

Where to get XFree86/XDarwin

Installing XFree86/XDarwin

Downloading and Installing Updates to the XDarwin Application

Using Commands for X11 (like xedit, xterm, xclock, etc.) from a Terminal.app Window
(In other words, getting your PATH and DISPLAY set up correctly...)

Forwarding X11 from a Remote Computer to the Mac

Copy and Paste between X11 and OS X

More Places to Find Help on XDarwin

Places to Find Help on Using the Command Line



What is XFree86?

XFree86 is a free, cross-platform implementation of the X Window System (X11). It is available as source code from the XFree86 Project, although prebuilt binaries for a large number of platforms can also be downloaded.


What is XDarwin?

XDarwin is the name given to XFree86 for Mac OS X (and for Darwin, the core of OS X). Specifically, it is the name given to the X server executable file itself (in /usr/X11R6/bin and in the XDarwin application's bundle, XDarwin.app/Contents/MacOS).

However, it includes much more than just the X server itself. There are many X11 client programs (in /usr/X11R6/bin), such as xterm, xedit, xeyes, xcutsel etc., as well as fonts (in /usr/X11R6/lib/X11/fonts) and libraries (in /usr/X11R6/lib) to compile your own X11 client applications.

So, what is this application, called XDarwin, that's available from the XonX site?

The XDarwin application, from XonX, is the part of the XDarwin X server that works with Mac OS X in fullscreen mode or rootless mode. Release 4.1 of XFree86 included a version of XDarwin.app that worked fullscreen, but not rootless. The updates available from the XonX site since XFree86 4.1 added rootless capability to XDarwin.app.

Often, the name "XFree86" (on OS X) is used to refer to what is really XDarwin, and the name "XDarwin" is used to refer to the XDarwin application as an "extra patch for XFree86".

However, XDarwin is not a separate project from XFree86! -Think of it as follows:

XDarwin=XFree86 for Mac (OSX & Darwin)
XDarwin application (XDarwin.app)=rootless & fullscreen XDarwin X server


What is Darwin, and how is it Different to XDarwin?

Darwin is an opensource operating system which is unix-based. It lies at the core of Mac OS X.

However, Darwin is not Mac OS X, and it does not include any GUI (graphical user interface), relying instead on the command line for its control. You could think of OS X as being the GUI that lies on top of Darwin (although there is more to it than that, since it includes many extra frameworks for building Mac OS X applications).

XDarwin, as noted above, can provide a GUI for even the "bare" Darwin OS (without OS X), since it is a complete implementation of the GUI known as the X Window System (hence the name "XDarwin").

There are much better introductions to Darwin than I can give here, so I refer you to MacInstruct's Introduction to Darwin.


Where to get XFree86/XDarwin:

The easiest way to install X11 from scratch is to get the new installer from the XonX web site. This includes version 1.1 of the XDarwin application (the last version made available separately for XFree86 4.1 was XDarwin 1.0.6).

Alternatively, if you want to go about things the hard way (!), you can get XFree86 4.2 from the XFree86 Project. Follow the instructions below to find out which parts to download...
[You can also get XFree86 version 4.1 from the XFree86 Project. This does not include the rootless patch for XDarwin.app, so you will have to follow the instructions below to download and install the latest version of XDarwin.app after you have installed XFree86 4.1.]

In the ftp directory for the XFree86 project (linked to above), download files "Install", "Xinstall.sh" and "extract". (I suggest you create a directory somewhere to put all these files that you are downloading.)

There are some parts that you can opt out of dowloading, but you must download the files "Xbin.tgz", "Xlib.tgz", "Xman.tgz", "Xdoc.tgz", "Xfnts.tgz", "Xfenc.tgz", "Xetc.tgz", "Xxserv.tgz" and "Xquartz.tgz" in order to use X11.
Note that it is a big download - nearly 30 megabytes for just the files listed above.

The files "Xf100.tgz" and "Xfscl.tgz" are worth getting for the extra fonts (note that Xf100.tgz is itself about 10 megabytes); and you will also need file "Xprog.tgz" if you are planning on compiling any X11-based applications.

Once you have downloaded what you want, and you are ready to install, it is well worth taking a few moments to read through (at least) section 3 of the "Install" file I mentioned above. This explains how to actually go about using the "Xinstall.sh" script to install X11 from the files you have downloaded.

Note that you must have Administrator privileges to install XFree86. This means that you either run the final install phase as user 'root', or you use the 'sudo' command and provide your password.


Installing XFree86/XDarwin:

With the new installer from XonX, just follow the instructions!

However, if you have downloaded XFree86 from the XFree86 Project, then read through section 3 of the "Install" file (as mentioned above), which gives a decent explanation of the installation procedure.

If you need further help then check out the list of extra resources at the bottom of this page...


Downloading and installing updates to the XDarwin application:

If you are installing an update to XDarwin.app separately from the entire XFree86 package, this will also require administrator privileges -and you should make sure that you unpack the XDarwin 'tarball' in the top level directory. Often your browser will automatically unpack when you download. You don't want this to happen! Follow these instructions instead:

  1. Go to the XonX website, where you will find the latest version of XDarwin.app (or versions up to 1.0.6 if you are using XFree86 4.1), and tell your browser to download the tarball to a specific directory on your disk (let's choose your home directory for these instructions) via a popup menu (in Explorer on OS X this popup appears if you press and hold the mouse button down on a link, or if you control-click on the link);
  2. Once it has downloaded into your home directory, open up a Terminal window and type the following (these commands do assume that you have downloaded version 1.0.6 of XDarwin for OS X 10.1 to your home directory -if it is another version then substitute the correct file names in the commands below):
    cd
    gunzip XDarwin1.0.6.1.tgz
    cd /
    sudo tar xvf ~/XDarwin1.0.6.1.tar
    
    (Note that you will need to give your password at the last 'sudo' command.)

    Note: Although it may be tempting to install XDarwin.app as a 'normal' user, in your own personal folder, and even though it may actually work as a double-clickable application, doing so could break your X11 setup at some point - for example, the 'startx' command will not work correctly because there are files in /usr/X11R6/bin that expect the XDarwin application to be in the Applications folder. (If you know what you're doing, though, you could set up the links to point to wherever you put XDarwin.app.) Since OroborOSX uses a 'startx-like' mechanism, this will also not work correctly...

  3. You should see a list of files fly up your window as they are installed -and if you check your Applications folder (in Finder), you should see an icon that looks like a large red X. If so, then you have probably done everything correctly!


Using Commands for X11 (like xedit, xterm, xclock, etc.) from a Terminal.app Window
(In other words, getting your PATH and DISPLAY set up correctly...)

There are many people who do not realise that you can run X11 commands from Apple's Terminal - all you need to do is make sure that your PATH and DISPLAY variables are set up correctly.

The best way to find out what you need to do is to try typing a simple command (like "xterm") into a Terminal.app window. There are two common problems encountered:


Forwarding X11 from a Remote Computer to the Mac

This is probably the most commonly asked question, with various possible issues that can arise. As a result it now has its own page with lots more detail on diagnosing problems, and a new section on using the "xauth" mechanism (which is preferable to just using "xhost").

However, here is a quick list of the three methods (in order of preference), with links to the more detailed instructions:

  1. Use "ssh -X";
  2. Use xauth with your DISPLAY environment variable;
  3. Use xhost with your DISPLAY environment variable;


Copy and Paste between X11 and OS X:

Copy and paste in X11 is certainly... how shall I say this... "different"!

There are, unfortunately, at least two common models in X11. So, before looking at how to copy and paste between X11 and OS X, we must understand how to copy and paste within X11.

Here is the first of the copy/paste models in X11:

The second copy/paste model in X11 tends to look and feel more like the copy/paste you are used to on the Mac. i.e. you choose "Copy" or "Cut" from the X11 application's "Edit" menu, then you choose "Paste". This is known as the "PRIMARY" buffer.

Unfortunately, having these two models can cause problems when it comes to copying and pasting between X11 and OSX. As we shall see, this is where the little X11 app called "xcutsel" comes in handy...

However, let's first look at copying and pasting between X11 and OS X just using the selection buffer:

XDarwin automatically puts the contents of the Mac's clipboard into the X11 selection buffer. It also automatically (unfortunately, IMHO) puts the X11 selection into the Mac's clipboard.

In other words, you can copy from OS X apps using cmd-C, then paste into X11 using the middle mouse button (or whatever emulation you have set up for middle-click -command-click is the default), and you can copy from X11 just by selecting text and then paste into an OSX app using cmd-V.

OK, that's fine for the selection buffer, but if an X11 app uses the more "Mac-like" copy/paste, you will have to use the xcutsel application...

In an X11 terminal window type "xcutsel". You should see a little window appear which has three buttons: "quit", "copy PRIMARY to 0" and "copy 0 to PRIMARY". A little bit of experimentation with a "Mac-like" copy/paste X11 app and the two lower buttons should allow you to copy and paste everything you want between X11 and OS X.

There is also an app (available via fink, I think) called autocutsel, which does various things to the two buffers, such as keeping them synchronised etc. This may also be well worth trying instead of xcutsel.


More Places to Find Help on XDarwin:

If you are having trouble launching the XDarwin application, or starting X11 using the 'startx' command, it may be worth taking a look at the OroborOSX troubleshooting page - in particular, the answers to the second question may possibly be of some help.

However, here are a number of other resources that may provide help with installing and troubleshooting XDarwin, should you need it:


Places to Find Help on Using the Command Line:

If you are not used to the "power of Unix", and dare not type anything in a Terminal window for fear of your Mac bursting into flames, why not try out the following tutorials:



About
OroborOSX
Version
History
Download |
|
Troubleshooting E-mail lists
and forums
|
|
Introduction to
X11 on OSX
About
XDarwin
XDarwin
forums
|
|
About
Oroborus


Contact Info:

I can be contacted as follows: adrian@ic.ac.uk

Web page: http://amcg.ese.ic.ac.uk/~adrian/

I hope somebody somewhere finds this useful!

Adrian Umpleby