Skip to content

Custom build script Xcode Cloud

Published: at 08:38 AM

While configuring Xcode Cloud for Wordsmith, I stumbled upon a build error where dependency that use Macro need to be enabled before it can be used.

error xcode cloud

This is common error when you use third party dependency via SPM that also have macros dependency. In Xcode when this happens, usually a pop up is shown and you can click Trust to make it enabled. However since this is happening on Xcode Cloud we need some scripts to do it.

From Xcode Cloud documentation, we can run 3 different scripts on different stages of build process:

We must place all of those three scripts on folder called ci_scripts in order to Xcode Cloud to be able to recognize and run it.

xcode cloud custom scripts

So to solve build failure for Wordsmith, I create ci_post_clone.sh that contains this following code

#!/bin/sh
#
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES

Few notes:

  1. Scripts must include a shebang in the first line #!/bin/sh
  2. Make the script executable by running chmod +x filename.sh