tags:

views:

1846

answers:

4

It looks like xcode's $PATH environment setting is different from my user shell environment.

Where does xcode get the $PATH setting from and what's the best way to append to the search path?

+3  A: 

XCode gets its environment variables the same way as other OS X processes, from ~/.MacOSX/environment.plist.

Check developer.apple.com/qa/qa2001/qa1067.html for details on how to set things.

wac
Hmmm... I don't have a file like that. Is there a global version of this that applies to all users?
lajos
+2  A: 

if you're writing a Run Shell Script build phase, you can just do:

PATH=${PATH}:/opt/local/bin

or whatever inside the script content.

Graham Lee
thanks you, this is what I'm doing currently, but I'm hoping to find a "global" way that would apply to the whole build process
lajos
+1  A: 

If you are talking specifically about the executable search path environment variable named PATH, then there are a few places that it is set:

  • In your shell settings if it is a command line tool. Depending on your shell, this could be ~/.cshrc, ~/.profile, ~/.bash_profile, etc.
  • In the environment.plist file that was mentioned earlier.
  • If you are in a debugger, then it is whatever gdb uses. I believe that gdb will read commands from ~/.gdbinit if it exists.
  • XCode lets you set environment variables within the Info page for executables.
D.Shawley
A: 

Xcode doesn't look at your shell path environment.

Have a look at NSProcessInfo; and do an NSLog to see what comes up.

If you want a path to apply to all graphical programs you need to set up the ~/.MacOSX/environment.plist. as described.

The recommended way to set the environmen variables are actually in /etc/paths and etc/paths.d although these are also not picked up by Xcode.

I asked about this here.

Abizern