Can not start XQuartz

It is important for the XQuartz app to inherit a proper PATH from launchd. The path of the systemwide launchd is /usr/bin:/bin:/usr/sbin:/sbin by default; you can check its value by running

sudo launchctl getenv PATH

If is not as expected, it has most likely been set by a command in /etc/launchd.conf. (This file contains commands in the format expected by launchctl; see the manual page for the latter.)

When you log in, launchd forks a process that becomes the per-user launchd. This inherits the environment from the system launchd, but its environment can be further altered by the commands in /etc/launchd-user.conf and the contents of ~/.MacOSX/environment.plist. Look in these places for alterations to the PATH environment variable, and make sure it at least contains the four paths mentioned above. You can check its value by running

launchctl getenv PATH

(note: no sudo). While experimenting, you can change the environment of your launchd by running

launchctl setenv PATH /usr/bin:/bin:/usr/sbin:/sbin

and then stopping and restarting XQuartz.app. But once you have a solution that works, use either one of /etc/launchd-user.conf or ~/.MacOSX/environment.plist to set the appropriate value permanently. Use the former for all users, and the latter if it's a personal preference.


Even when XQuartz 2.7.x is properly installed, the Gimp doesn't know about it yet. So when the Gimp starts up, it resorts to the default windowing system, being the native X11 from Mac OSX. You need to alter the start-up script of the Gimp, to make it start XQuartz before the actual binaries of the Gimp are started. To solve this problem, you need to do the following (I'm presuming you don't know how to work in a terminal, so we'll click around in the graphical interface):

  • in Finder, go to Applications (or the folder into which the Gimp 2.8.0 has been installed) and right-click on the icon of the Gimp.
  • in the drop-down menu, select the second option from the top below 'open': show contents, or something similar in your language). A new Finder window will open with root 'Contents'.
  • left-click on 'Contents', left-click on 'Resources', right-click on 'script'. From the drop-down menu, choose 'Open with'. From the drop-down menu, don't choose 'Terminal.app', do choose 'Other...'
  • From the possible applications to open with, choose 'Texteditor.app'.
  • Don't get scared from what you see; it's just shell scripting.
  • Scroll down until you see the following lines of code:

    if [ -e "/tmp/skl/Gimp.app/Contents/Resources/bin/set-fontsize" ]; then
        set-fontsize
    fi
    cd ~/ > /dev/null
    #exec "$CWD/bin/gimp" "$@"
    
  • Add the following line of code just above the line that starts with the "cd ~/" etc.:

    #exec "~/Applications/Utilities/XQuartz.app/Contents/MacOS/X11" 
    
  • So that it now looks like:

    if [ -e "/tmp/skl/Gimp.app/Contents/Resources/bin/set-fontsize" ]; then
        set-fontsize
    fi
    #exec "~/Applications/Utilities/XQuartz.app/Contents/MacOS/X11"
    cd ~/ > /dev/null
    #exec "$CWD/bin/gimp" "$@"
    
  • Save (cmd-s, or via menu) and quit Texteditor.

Now when you start the Gimp, you'll notice that XQuartz is being loaded before the Gimp starts instead of the default X11-windowing system. It works for me.

Hope it helps you, Good luck, and happy Gimping!