Today I discovered that X11.app no longer works on my Mac. I'm not sure when this happened. I think it's been several weeks since I last used an X11 application.
By "no longer works" I mean it does absolutely nothing. If I try to run X11.app directly, nothing appears in the dock and there is no error message — it's as if I didn't run it at all.
If I try to run an X application from the Terminal (eg: xterm) it just hangs forever. I assume it's waiting for X11 to start up.
I tried reinstalling X11 from the Snow Leopard install DVD, and that doesn't seem to have had any effect.
Update
I have MacPorts installed and it looks like xorg-server
may have been
installed. I tried uninstalling it…
port -u uninstall xorg xorg-server
…and reinstalling it…
port install xorg xorg-server
…but either way things don't work.
Here's what /var/log/system.log
shows when the MacPorts xorg is
installed.
Dec 1 14:28:26 Stripy org.macports.X11.stub[51551]: Xquartz: bootstrap_look_up(): Unknown service name
Dec 1 14:28:27 Stripy org.macports.startx[51470]: waiting for X server to begin accepting connections
Dec 1 14:28:27 Stripy org.macports.startx[51470]: xinit: giving up
Dec 1 14:28:27 Stripy org.macports.startx[51470]: xinit: unable to connect to X server: Operation timed out
Dec 1 14:28:27 Stripy org.macports.startx[51470]: waiting for X server to begin accepting connections xinit: server error
Dec 1 14:28:27 Stripy org.macports.startx[51470]: waiting for X server to begin accepting connections
Dec 1 14:28:27 Stripy defaults[51670]: \nThe domain/default pair of (org.macports.X11, dpi) does not exist
Dec 1 14:28:27 Stripy org.macports.startx[51638]: xauth: file /Users/laurence/.serverauth.51639 does not exist
Dec 1 14:28:28 Stripy org.macports.startx[51638]:
Dec 1 14:28:28 Stripy org.macports.X11.stub[51723]: Xquartz: Unable to locate waiting server: org.macports.X11
Dec 1 14:28:28 Stripy org.macports.X11.stub[51727]: Xquartz: Starting X server: /Applications/MacPorts/X11.app/Contents/MacOS/X11 --listenonly
Dec 1 14:28:30 Stripy org.macports.startx[51638]: ^M
Dec 1 14:28:32 Stripy org.macports.startx[51638]: waiting for X server to begin accepting connections
Dec 1 14:28:48: --- last message repeated 8 times ---
This repeats over and over, (modulo time stamps and pids).
Here's what t looks like when the MacPorts xorg is not installed.
Dec 1 14:55:32 Stripy defaults[64771]: \nThe domain/default pair of (org.macports.X11, dpi) does not exist
Dec 1 14:55:32 Stripy org.macports.startx[64737]: xauth: file /Users/laurence/.serverauth.64738 does not exist
Dec 1 14:55:32 Stripy org.macports.startx[64737]:·
Dec 1 14:55:32 Stripy org.macports.startx[64737]: xinit: unable to run server "/opt/local/bin/X": No such file or directory
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Use the -- option, or make sure that /opt/local/bin is in your path and
Dec 1 14:55:32 Stripy org.macports.startx[64737]: that "/opt/local/bin/X" is a program or a link to the right type of server
Dec 1 14:55:32 Stripy org.macports.startx[64737]: for your display. Possible server names include:
Dec 1 14:55:32 Stripy org.macports.startx[64737]:·
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Xquartz Mac OSX Quartz displays.
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Xvfb Virtual frame buffer
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Xfake kdrive-based virtual frame buffer
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Xnest X server nested in a window on another X server
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Xephyr kdrive-based nested X server
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Xvnc X server accessed over VNC's RFB protocol
Dec 1 14:55:32 Stripy org.macports.startx[64737]: Xdmx Distributed Multi-head X server
Dec 1 14:55:32 Stripy org.macports.startx[64737]:·
Dec 1 14:55:34 Stripy org.macports.startx[64737]: xinit: giving up
Dec 1 14:55:34 Stripy org.macports.startx[64737]: xinit: unable to connect to X server: Connection refused
Dec 1 14:55:34 Stripy org.macports.startx[64737]: xinit: server error
Dec 1 14:55:34: --- last message repeated 1 time ---
Again, this repeats over and over.
I also tried uninstalling the macports xorg
and then installing
XQuartz (and again, rebooted to be sure). Running
Applications/Utilities/XQuartz doesn't work, nor does trying to run
xterm
from Terminal, Here's the output of /var/log/system.log
with
that setup:
Dec 1 16:13:01 Stripy org.macosforge.xquartz.startx[343]: waiting for X server to begin accepting connections
Dec 1 16:13:01 Stripy org.macosforge.xquartz.X11.stub[400]: Xquartz: bootstrap_look_up(): Unknown service name
Dec 1 16:13:02 Stripy org.macosforge.xquartz.startx[343]: waiting for X server to begin accepting connections
Dec 1 16:13:02 Stripy org.macosforge.xquartz.startx[343]: /opt/X11/bin/xinit: giving up
Dec 1 16:13:02 Stripy org.macosforge.xquartz.startx[343]: /opt/X11/bin/xinit: unable to connect to X server: Operation timed out
Dec 1 16:13:02 Stripy org.macosforge.xquartz.startx[343]: waiting for X server to begin accepting connections /opt/X11/bin/xinit: server error
Dec 1 16:13:02 Stripy org.macosforge.xquartz.startx[343]: waiting for X server to begin accepting connections
Dec 1 16:13:02 Stripy defaults[544]: \nThe domain/default pair of (org.macosforge.xquartz.X11, dpi) does not exist
Dec 1 16:13:02 Stripy org.macosforge.xquartz.startx[510]: xauth: file /Users/laurence/.serverauth.511 does not exist
Dec 1 16:13:02 Stripy org.macosforge.xquartz.startx[510]:
Dec 1 16:13:02 Stripy org.macosforge.xquartz.X11.stub[588]: Xquartz: Unable to locate waiting server: org.macosforge.xquartz.X11
Dec 1 16:13:02 Stripy org.macosforge.xquartz.X11.stub[589]: Xquartz: Starting X server: /Applications/Utilities/XQuartz.app/Contents/MacOS/X11 --listenonly
Dec 1 16:13:03 Stripy login[619]: USER_PROCESS: 619 ttys000
Dec 1 16:13:04 Stripy org.macosforge.xquartz.startx[510]: ^M
Dec 1 16:13:06 Stripy org.macosforge.xquartz.startx[510]: waiting for X server to begin accepting connections
Dec 1 16:13:22: --- last message repeated 8 times ---
(Once again, repeating.)
I've tried searching for some of these messages, and found a couple of
hits but no concrete solutions.
Best Answer
X11 on OS X requires a pair of
launchd
plist
files to be active; this pair must match, and also must be configured correctly atlogin
time. Each of the X11 servers provides its own pair:/System/Library/LaunchDaemons/org.x.privileged_startx.plist
and/System/Library/LaunchAgents/org.x.startx.plist
;/Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
and/Library/LaunchAgents/org.macosforge.xquartz.startx.plist
;/Library/LaunchDaemons/org.macports.privileged_startx.plist
and/Library/LaunchAgents/org.macports.startx.plist
.It's quite common for these to get mixed up when multiple X11 installations are present. Best bet is to disable all of the startx LaunchAgents with
launchctl unload -w
, then enable only the one you want to use withlaunchctl load -w
(the-w
tellslaunchctl
to remember the action for subsequent boots/logins). Do not unload the LaunchDaemons. It is necessary to log out and back in after this in order for the DISPLAY environment variable to be set correctly.