How can I limit a "Run Script" build phase to my release configuration?

XcodeMacosXcode Build-Settings

Xcode Problem Overview


I have a shell script that I would like to run at the end of my target's build phase. However, I would like this script to only run when I build with the release configuration. How can this be done? Thanks!

Xcode Solutions


Solution 1 - Xcode

if [ "${CONFIGURATION}" = "Release" ]; then
  echo Do something really release-like
fi

The script will run at the end of every configuration, but it won't do anything in this case unless the configuration is Release (assuming everything it does is contained within the test block).

Solution 2 - Xcode

The easiest way to do this, is checking the "Run script only when installing" checkbox.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionReed OlsenView Question on Stackoverflow
Solution 1 - XcodeJason CocoView Answer on Stackoverflow
Solution 2 - XcodeMennoView Answer on Stackoverflow