0

I'm having trouble with XQuartz on Mavericks. After I went to apple genius support to change my battery (in which the genius guy forced power off when I had an X11 connection opened), I am having the following crash when I try to open XQuartz:

*** The application X11 could not be opened. ***
An error occurred while starting the X11 server: "Cannot establish any listening sockets - Make sure an X server isn't already running"
Click Quit to quit X11. Click Report to see more details or send a report to Apple.

I've tried to make a clean install of the XQuartz by doing:

launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil —forget org.macosforge.xquartz.pkg

And then installed XQuartz latest version (in actual date it is this one). Log-out, log-in, no success.

I also tried deleting /private/tmp/.X* files, /private/tmp/launch-* folders which contained xquartz displays and also the .Xauthority file in the $HOME directory.

Since this didn't work, I've struggled to use the port xorg-server X11, using sudo port install xorg-server after uninstalling XQuartz. I also had to make it active using launchctl load -w /Library/LaunchAgents/org.macports.startx.plist(found here) and also used sudo port -f deactivate xinit && sudo port activate xinit (found here).

Unfortunately it didn't work also (I got an error on the server saying it had not permissions to open the $DISPLAY on my local machine).

Other treads in superuser talking about the similar issue:

  1. Issue on mavericks, no answer on this topic.
  2. Issue on snowleopard: I need to redo this launchctl load -w again paying attention to the sudo tip which I didn't know about.

I have tried every combination possible and exhausted searching the internet for possibilities. I am dead in the water here guys , any ideas?

Werner
  • 225

2 Answers2

2

As reported in ticket 589, this can happen due to bugs in your shell init scripts.

As reported in ticket 685, this can happen if you replace /usr/bin/mktemp with an incompatible version (eg: GNU mktemp).

0

Today I had time to look again into this, and what is funny though is that I don't even needed to have the original mktemp available on /usr/bin/mktemp path (you shouldn't do this, this is only to illustrate that the previous discussion about the mktemp binary had nothing to do with the issue):

`--> ls /usr/bin/mktemp
ls: cannot access /usr/bin/mktemp: No such file or directory

my issue was probably the installation of port xquartz together with the original xquartz. I made a complete uninstall on both clients:

sudo port uninstall xinit xorg-server

And for the "original" xquartz (info here, look for "Uninstall (Snow Leopard or Later)"):

launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg

Some of those may fail since the port uninstallation may deactivate those, you can ignore those fails.

This is important. In my previous attempts, I was failing probably because I wouldn't restart my account, which seems that is needed in order to the launchctl to make effect (I might be wrong over here, but anyway, it is important for you to logout and login your account for the installation changes to take effect).

With the clean environment, now install the XQuartz, log-out, log-in and it should work. If not, take a look in the following debug instructions from XQuartz, look for "ssh X forwarding debugging":

[1] local $ echo $DISPLAY
/tmp/launch-Bh0fLm/:0
[2] local $ grep DISPLAY ~/.*rc ~/.login ~/.*profile ~/.MacOSX/environment.plist 2>/dev/null
[3] local $ grep -r DISPLAY /opt/local/etc /sw/etc /etc 2>/dev/null
[4] local $ ssh -Y remote
Warning: No xauth data; using fake authentication data for X11 forwarding.
[5] remote $ echo $DISPLAY
localhost:10.0
[6] remote $ grep X11 /etc/ssh/sshd_config ~/.ssh/*
X11Forwarding yes
X11DisplayOffset 10

My issue started on the first line, where the DISPLAY variable was empty. I would run commands 2 and 3, and there was nothing changing it, so I new there the problem was something with the launchtcl, and had nothing to do with steps 4 and afterwards. But your case could be different, so follow this debug instructions to check what your problem may be.

Werner
  • 225