问题
I want to import the bash PATH
environment variable (where it is set in ~/.bash_profile
) into one particular Xcode project (I'm using Xcode 11).
This is because I want to use a Makefile compile that Xcode project, and the Makefile uses the bash PATH
environment variable. Specifically I use compilers and libraries that I installed using MacPorts, so I want Xcode to look in /opt/local/bin:/opt/local/sbin
, like the Makefile does.
In Xcode I've tried adding these in Edit scheme > Environment Variables
, and in Build Settings
for both the project and its (external-build) target, as described in the answers to this question, but it hasn't appeared to have made a difference.
(The specific problem that I'm trying to fix is described in my question here.)
回答1:
I worked it out how to do the bigger issue that generated this question. See my answer to my original question.
I'm not sure which exact part, or which combination, imported the PATH
correctly from bash into Xcode, answering this question.
I had definitely entered the PATH
into Build settings
and Environment Variables
when I originally asked this question. Perhaps the difference was ticking the Pass build settings in environment
checkbox in step 5 here, which I am not sure whether I did when I asked this question.
In any case it works now.
来源:https://stackoverflow.com/questions/60921911/importing-path-from-bash-into-xcode