How to stop Xcode build from shell script How to stop Xcode build from shell script shell shell

How to stop Xcode build from shell script


You need to return a non-zero exit code from the script:

exit 1


Another useful technique is for the script to produce an output with an "error: " prefix.This will cause Xcode to show the error within the build logs, and if you Xcode settings stop building on failure - it will stop right there.

In addition to this, you could also trigger a warning by printing out "warning: " prefix.

Example:

if [ -d ~/Desktop/MyFolder ]; then    cp -r ~/Desktop/MyFolder ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MyFolderelse    echo "error: Copy failed!"fi