Why PATH is not available for custom shell scripts executed from Xcode? Why PATH is not available for custom shell scripts executed from Xcode? shell shell

Why PATH is not available for custom shell scripts executed from Xcode?


You could explicitly source the users .bashrc, .profile etc. Or better yet, run something like

PATH=$(bash -l -c 'echo $PATH')

which won't risk polluting other variables.


Ivan Andrus' answer led me to what I think is a cleaner and more complete method: run the script within a new shell altogether. For example:

bash -l -c "./configure --prefix=${DERIVED_FILE_DIR} && make && make install"

I'm using double-quotes for variable expansion. It's a good idea to expand out any variables you need, because any existing vars might be overwritten by the ones created for the new environment.


You might want to follow this thread:Setting environment variables in OS X?I have good luck with environment.plist.