X11.app (on SnowLeopard) won't start

3

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.

Laurence Gonsalves

Posted 2011-12-01T07:28:36.273

Reputation: 5 021

Have you tried XQuartz?

– ephemient – 2011-12-01T07:55:24.630

No. I'm open t trying it out, though I'd like to know why the stock X11 is failing. – Laurence Gonsalves – 2011-12-01T17:25:50.717

@ephemient I have now tried XQuartz, and also MacPorts' xorg-server, and none of these configurations work. Please see the update to the question. – Laurence Gonsalves – 2011-12-02T00:40:58.940

Answers

7

X11 on OS X requires a pair of launchd plist files to be active; this pair must match, and also must be configured correctly at login time. Each of the X11 servers provides its own pair:

  • for Apple's X11, /System/Library/LaunchDaemons/org.x.privileged_startx.plist and /System/Library/LaunchAgents/org.x.startx.plist;
  • for MacOSForge XQuartz, /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist and /Library/LaunchAgents/org.macosforge.xquartz.startx.plist;
  • for MacPorts XQuartz, /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 with launchctl load -w (the -w tells launchctl 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.

geekosaur

Posted 2011-12-01T07:28:36.273

Reputation: 10 195

You should NOT disable any of the privileged_startx jobs. You need to have all of them loaded, but you probably want only one of the startx jobs loaded. – Jeremy Huddleston Sequoia – 2014-11-26T00:06:16.140

I should mention we're currently hashing this out on FreeNode IRC; the above is apparently not the complete answer. – geekosaur – 2011-12-02T02:00:26.487

1I've finally managed to fix this. It turns out that my .bashrc was doing something screwy. I still don't know why this would cause X11 to break in the way it did. – Laurence Gonsalves – 2011-12-02T19:21:21.020

If it is .bashrc then it is possible that you break your $PATH variable. – yumyai – 2011-12-26T01:03:56.107

2

My problem was similar. My .profile was 'source'ing my .bashrc and my .bashrc had an ancient test for interactivity:

# If not running interactively, don't do anything [ -z "$PS1" ] && exit

Changing the "exit" to a "return" did the trick for me.

Greg Tarsa

Posted 2011-12-01T07:28:36.273

Reputation: 21

I literally only recently added something similiar to prevent some slow options I only wanted loaded under special conditions. Unfortunately it broke a lot more than I could have expected. Your note helped me a lot. – SkyLeach – 2018-04-08T21:24:56.900

1

My .profile had exec bash at the end (to ensure that the .bashrc is executed). This was the reason why X11.app was not able to start.

After changing this to . .bashrc X11.app starts fine again.

rjs

Posted 2011-12-01T07:28:36.273

Reputation: 11