Xcode 7 doesn't evaluate environment variables in build settings

My goal is to make an Xcode project portable (among developers in my team) by removing any absolute paths (such as framework and header search paths) in the project configuration and replacing them with paths relative to environment variables. It looks like Xcode 7 beta doesn't evaluate them - and hence the build fails - whereas Xcode 6 does. I can see the variables are in the environment by echoing them from a custom build phase script. Is this a bug or does Xcode 7 have some new functionality or configuration regarding this?

Replies

I also use environment variables in pbxproj files for a similar purpose, and came to the same conclusion in beta 5. I also note, however, that when building from the command line via xcodebuild, they seem to work... did you discover any tricks or workarounds?

This worked for me (from the release notes):


The Xcode build system no longer automatically inherits the environment used to launch the app when running in the IDE. This prevents unnecessary rebuilds when Xcode.app is opened from the command line.

If necessary, users can opt in to the old behavior by entering this command in Terminal:

$defaults write com.apple.dt.Xcode UseSanitizedBuildSystemEnvironment -bool NO


https://developer.apple.com/library/prerelease/watchos/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc7_release_notes.html


Bart