OK, so X11 is not included in Mountain Lion anymore. That's OK, no biggie. Everyone everywhere says to go get the XQuartz packages for X11.

I'm a developer, though, and have a ton of software managed through MacPorts. I would like to install the xorg-server package, rather than the XQuartz package, so that I get all the package management benefits (updates, configuration management, one place with extra software installed, etc...)

The problem is, on OS X 10.7 and below, it used to be that a launchd agent would intercept requests for the X11 display and launch X11 on OS X. To replace the auto-launched X11, one would unload the Apple X11 plist and load the MacPorts X11 plist, which would change who gets to set the $DISPLAY variable and which X11 daemon is launched.

It looks like this is the case for how X11 is launched from the xorg-server package still. Theoretically, any attempts to connect to X11 or dbus will cause launchctl to start the MacPorts X11 daemon.

This part is fine, see:


However, the old launch agent plist from Apple that would launch their X11 does not appear to be there anymore: a dialog pops up to get you to install XQuartz, and that dialog is intercepting launches of X11 apps. I can't figure out how to replace the freaking "do you want to install XQuartz" messages, since they don't seem to be controlled by a launch daemon. I have a fine installation of X11 waiting to be used, but there's some interception of the request for the DISPLAY that is not happening with launchd anymore. How in the world do I tell Mountain Lion it's a bad kitty and should stop asking me to install something that I've already installed?

  • I'll take a look at this and try to answer here as soon as I get to upgrading my machine. In the meantime, why not try asking on the macports-users list? The packager is likely to read that list. – jstarek Aug 8 '12 at 21:41
  • Did you make any progress with this? – Evan Carroll Mar 24 '19 at 17:09

I gave up and took the easy way out which were to install XQuartz after the package was installed I just had to logout and login again and then I was able to start Gimp 2.8 which I installed through MacPorts.

I'm also a developer, but I'm just using X11 to run Gimp so no need for me to investigate other options further, so my recommendation would be to just accept it and waste no more clock-cycles on that ;-)


This is how to fix it:

sudo mv /usr/X11 /usr/X11.xstub
sudo ln -s /opt/X11 /usr/X11 

(this assumes you have xorg-server installed in default macports location)

As to why it happens, its because everything in stock OSX install points to xstub or libxstub, which pops up that dialog box.

Applications tend to link directly against the libraries in /usr/X11/lib, so they will trigger the pop-up, for example:

ldd /Applications/Games/Hotline\ Miami.app/Contents/MacOS/HotlineMiami.app/Contents/MacOS/HotlineMiami 
    /usr/X11/lib/libGL.1.dylib (compatibility version 1.2.0, current version 1.2.0)

Which links to libxstub:

ldd /usr/X11/lib/libGL.1.dylib
    /usr/X11/lib/libxstub.dylib (compatibility version 1.0.0, current version 1.0.0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.