Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I can't start Inkscape and Gimp. I have the latest Xcode and the latest xQuartz installed.

My logs shows:

6/2/12 1:30:15.957 PM org.macosforge.xquartz.startx: lockfile: Sorry, giving up on "/var/folders/9x/qkjwtrd52qbb5bcvb0zk4rqw0000gn/T//font_cache.lock"
...
6/2/12 1:56:41.324 AM [0x0-0xe20e2].org.inkscape.Inkscape: /Applications/Inkscape.app/Contents/Resources/bin/inkscape: line 132: cp: command not found
...
6/2/12 1:30:16.046 PM org.macosforge.xquartz.startx: /opt/X11/bin/startx: line 240: hostname: command not found

However I have the path set up. In my terminal (both normal and X11 terminal) the hostname command and the cp command executes correctly.

share|improve this question
    
I was going to say that this is an X11 problem, not an inkscape problem as your title indicates. But then you mention an “X11 terminal”, which I take to mean an xterm. Which seems to indicate that X11 is running, though your log messages indicate an inability to start X11. It is all a bit confusing. Perhaps you also have X11.app up and running? It shouldn't be, if you have XQuartz. –  Harald Hanche-Olsen Jun 2 '12 at 12:48
    
When I start the inkscape then I got the logs above. Then I start manually the X11 and from the xterm I have the cp and hostname commands. I have the path set.] –  Boti Jun 2 '12 at 15:08
1  
Du you have a file ~/.MacOSX/environment.plist? Or ~/.xinitrc or ~/.xinitrc.d/? To rule out any inkscape behaviour, try making sure that X11.app is not running, then run xterm from within a Terminal window. Does XQuartz start up? If not, could you list the resulting lines in /var/log/system.log? And what is the output of pkgutil --pkg-info org.macosforge.xquartz.pkg? –  Harald Hanche-Olsen Jun 2 '12 at 18:31
    
Hi Harald, I don't have neither ~/.xinitrc or ~/.xinitrc.d/... And the result of 'pkgutil --pkg-info org.macosforge.xquartz.pkg' is: package-id: org.macosforge.xquartz.pkg version: 2.7.14 volume: / location: install-time: 1338649578 –  Boti Jun 2 '12 at 19:17
    
Try installing the latest XQuartz (2.7.2) from xquartz.macosforge.org before proceeding further. It will show up as 2.7.28 in pkgutil output. Then try the other experiment I outlined above. –  Harald Hanche-Olsen Jun 3 '12 at 9:52
show 9 more comments

2 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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