Search code examples
xcodeshellbuild-settings

Result of shell script as build setting


Is it possible to run a shell script and use its result as a user defined macro in Xcode?

Basically I just want the result of a shell script to be put in a variable so it gets set in Info.plist (just like ${EXECUTABLE_NAME} etc.)

For example: If I add $(/usr/bin/whoami) as a build setting condition (at the bottom of settings of the build configuration) it just sets an empty string.


Solution

  • See this question for a couple of different approaches. All of them require add a "Run Script" build phase.