XCode Environment Settings

Easily Print XCode Environment Settings to a File

If you need to get a list of environment settings running under Xcode, use a run script to print them out to a file when you run your app.

Go to the Build Phases section of your target and add a Run Script by clicking the Add Build Phase button in the lower right-hand corner and choose Add Run Script.

AddScript

This adds an empty Run Script section to your Build Phases for the selected target.

Empty

Add the line printenv | sort > $SRCROOT/environs.txt as the script.

RunScript

$SRCROOT is the main folder of your app. Each time you run your app, the Run Script will create or overwrite the file environs.txt in the main folder with a sorted list of all of your environment variables. This will help you figure out where everything is hidden behind the scenes.

Here is an excerpt of the file on my machine.

CACHE_ROOT=/var/folders/7v/4b2ghpfx4sd5bgn6y1lc1rs80000gn/C/com.apple.Xcode.501
CCHROOT=/var/folders/7v/4b2ghpfx4sd5bgn6y1lc1rs80000gn/C/com.apple.Xcode.501
CHMOD=/bin/chmod
CHOWN=/usr/sbin/chown
CLANG_CXX_LANGUAGE_STANDARD=gnu++0x
CLANG_CXX_LIBRARY=libc++
CLANG_ENABLE_OBJC_ARC=YES
CLANG_WARN_CONSTANT_CONVERSION=YES
CLANG_WARN_EMPTY_BODY=YES
CLANG_WARN_ENUM_CONVERSION=YES
CLANG_WARN_INT_CONVERSION=YES
CLANG_WARN__DUPLICATE_METHOD_MATCH=YES

Let me know if this helps.