How to stop Xcode build from shell script
bash, shell, xcode
Solution
You need to return a non-zero exit code from the script:
exit 1
Problem
I am currently working on an app in Xcode where I've added a Build Phase that runs a shell script. The script looks for resources from the Desktop and copies them to the app . If the files/folders don't exist, the script should cancel the build of the app. I have tried various things to stop the build such as `xcodebuild clean` but I can't quite figure it out. Here is what I have: ``` if [ -d ~/Desktop/MyFolder ]; then cp -r ~/Desktop/MyFolder ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MyFolder else #Stop the build fi ``` Is there a way to have the script tell Xcode to stop the build? If so, how can I do it?