I have a cross platform unit testing framework that I use for C++. In order to build and run the tests in XCode 6.1 I need to run a python script as part of a prebuild script.
Since I use the same unit testing framework for multiple projects I figured it'd be great to use environment variables in my ~/.bash_profile
to point to the resources necessary for the python script. But it seems that XCode 6.1 doesn't load the bash_profile
before running the script in the build process. Are there alternatives to using the bash_profile
? Maybe I could add my environment variables to the XCode environment variables list? But this seems to be changing with each update to OSX. I can't seem to figure out where I can add environment variables for XCode 6.1.
You can run a shell script by adding a build phase to your target. The instructions are also here.
in your case you can do:
source ~/.bash_profile
python [your_script]
You can rearrange the order of your build phases by dragging them into the order you want.
NOTE: The environment variables defined in ~/.bash_profile will not be there when you run your program (at least in my experience). To add environment variables to the run command:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With