Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is $PATH set in xcode?

Tags:

path

xcode

People also ask

How do I find my PATH environment?

Select Start, select Control Panel. double click System, and select the Advanced tab. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it.


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.


This applies for OSX 10.7 and earlier ONLY.

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.


The easiest solution is to add the PATH variable in Xcode.

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

enter image description here


In Xcode 5 you can add your PATH as a variable to either a target or the project settings.

  1. Add a custom variable with the +sign on the top of the page
  2. Edit the name of the variable to be PATH and add your preferred value (e.g. /usr/local/bin for a default install of homebrew.

Target Build Settings


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.

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.