10.5: A few tips on using X11 in 10.5

Nov 07, '07 07:30:00AM

Contributed by: n8gray

In Leopard, X11 is now launched on demand by launchd, which means it's now started automatically any time you start an X application. This is a very good thing, but it means that you may have to fix your configuration files. In particular, launchd is now in charge of setting the DISPLAY variable, so if you manually set it (say, in ~/.bashrc or ~/.MacOSX/environment.plist), your X apps will be unable to find the server. To make things work properly, just don't touch the DISPLAY variable at all in your init scripts.

Also, this means you shouldn't keep X11.app in your Dock. If you launch it by clicking on its Dock icon, you'll end up with another X11 icon in the dock. (For reference, here's a very informative post on the subject from Apple's x11-users mailing list.)

Finally, I experienced a problem with USB Overdrive and Leopard's X11 where none of my X11 apps would stay focused for more than a second or two. Upgrading to the newest USB Overdrive release solved the issue.

[robg adds: One of the reviewers on the queue site adds that you can put this code in your .bashrc file to make sure you don't set the DISPLAY variable:

if [ "$DISPLAY" == "" ]; then
export DISPLAY=:0
I haven't tested this one.]

Comments (15)

Mac OS X Hints