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 t
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.
This is an update for later versions of macOS and Xcode as things have altered. This is with Xcode 11.0 and macOS 10.14
The biggest issue is that ~/.MacOSX/environment.plist does not get read now.
This means that if in the build you need the PATH set, e.g. for external builds and they run executables there is no simple solution. /etc/paths does not seem to be read either.
The solution is as in @GhostLyrics answer to add the PATH variable in Build Settings. However as noted in comments Xcode will not just use that value but it puts its own values before that. Also it does a straight textual substitution and so you need to also add the separator that PATH uses i.e. the : (colon). The value I have added is :opt/local/bin
I also found that you can only do this for a target and not at the project level.
This is the simple case as in this answer
PATH=${PATH}:/opt/local/bin
or whatever inside the script content.
Alternatively put this change in your non login shell starter file e.g. ~/.bashrc ~/.zshrc
This is done in the Schema in the Run portion. Set PATH in the environment variables as stated in answers here. Note I have not tried this and I am not certain how much of the PATH needs setting.
The easiest solution is to add the PATH variable in Xcode.
PATH=${PATH}:/usr/local/bin
If you are talking specifically about the executable search path environment variable named PATH, then there are a few places that it is set:
~/.cshrc
, ~/.profile
, ~/.bash_profile
, etc.environment.plist
file that was mentioned earlier.~/.gdbinit
if it exists.Try opening your xcode project from the terminal, this worked for me: open some.xcodeproj
Instead of opening xcode and then loading the project or double clicking on it.
I know... silly
Nothing was working for me in XCode 7.
You need to set the PATH variable in XCode schemes.
Found the solution at: Where to set environment variables for app?