Xcode variables
The best source is probably Apple's official documentation. The specific variable you are looking for is CONFIGURATION.
Here's a list of the environment variables. I think you might want CURRENT_VARIANT
. See also BUILD_VARIANTS
.
They're not all documented. For example, you won't find ARCHIVE_PATH
, MARKETING_VERSION
(the version string set in Xcode) in Naaff's or smorgan's answer. These 2 are very common pieces of information someone would need! Here's a list of all of them I got: https://gist.github.com/ben-xD/c063b0ca2c33684de1eb379bb9d6405d
How I got them
I found the best way was to print them using set
, I just wrote this including a method to list all the environment variables available.
Add this to your run script (either Archive post run script, or your build phases run script, etc.):
#!/bin/shexec > ${PROJECT_DIR}/environment_variables.log 2>&1set
Look in environment_variables.log
and you'll see them all.