Xcode 10.2.1 Command Phasescriptexecution Failed with a Nonzero Exit Code
Showing Recent Messages: -1: Mkdir -P /Users/Spritzindia/Library/Developer/Xcode/Deriveddata/Contigo-Atftiouzrdopcmcpprphpilawwzm/Build/Products/Debug-Iphonesim...
Showing Recent Messages:-1: mkdir -p /Users/spritzindia/Library/Developer/Xcode/DerivedData/Contigo-atftiouzrdopcmcpprphpilawwzm/Build/Products/Debug-iphonesimulator/
Showing Recent Messages:-1: rsync --delete -av --filter P .*.?????? --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/pothi/Library/Developer/Xcode/DerivedData/Contigo-atftiouzrdopcmcpprphpilawwzm/Build/Products/Debug-iphonesimulator/IQKeyboardManagerSwift/IQKeyboardManagerSwift.framework" "/Users/pothi/Library/Developer/Xcode/DerivedData/Contigo-atftiouzrdopcmcpprphpilawwzm/Build/Products/Debug-iphonesimulator/"
Command PhaseScriptExecution failed with a nonzero exit code
I deleted derived data. i have tried :
keychain access -> right click on login -> lock & unlock again -> clear Xcode project
Restarted machine, no use
How do I resolve "Command PhaseScriptExecution failed with a nonzero exit code" error when trying to archive project.
And I am using those librarys
pod 'IQKeyboardManagerSwift'
pod 'SDWebImage', '~> 4.0'
pod 'KRPullLoader'
pod 'Paytm-Payments'
After trying all the solutions, I was missing is to enable this option in:
Targets -> Build Phases -> Embedded pods frameworks
In newer versions it may be listed as:
Targets -> Build Phases -> Bundle React Native code and images
- Run script only when installing
Go to
Keychain Access->Right-click on login->Lock & unlock againXcode->Clean Xcode project->Make build again
Run the following commands from the ios directory:
pod deintegratepod install- XCode Clean build
Or, One-Liner:
pod deintegrate; pod install
Warning: Legacy Build System is deprecated and will be removed in a further release.
Xcode -> File -> Workspace Setting -> change Build System to Legacy Build System.
Note - Its not the ideal solution.
For me, I was removing Crashlytics, Fabric and FirebaseCrashlytics. So there was a script (Run Script) for Fabric. So since app was running that first and I had removed the framework already, I was getting this error. So I removed the Run Script tab for Fabrics and then it worked perfectly fine.
Xcode 12.2 solution: Go to:
- Build settings -> Excluded Architectures
- Delete "arm64"
I was facing this issue because of Firebase Crashlytics. In Targets -> Build Phases -> Run Script
I had Firebase Crashlytics written like
${PODS_ROOT}/FirebaseCrashlytics/run
I changed that and put it in double quotes
"${PODS_ROOT}/FirebaseCrashlytics/run"
I have faced the same issue in Xcode 13. I have updated the Crashlytics SDK after that I got the same issue. In my case I have followed the Solution2
Solution1:
I have removed the data from Run Script.
-> Targets ->go to Build Settings ->Click Run Script -> Remove data
Solution2:
If script is mandatory to your project just select install builds only option.
Select For install builds only option
Script:
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/#####/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
In the above script ##### is the app name, if required use your app name. If not use below script.
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
Solution 3
And one more importent thing is you must set the path of the file properly.
Find the below example path.
You have multiple google services plist piles, in this case you are maintaining 2 different files. Your google service info plist file was under FireBase, Dev. In this case you must add these files path properly. Otherwise you will get the same error.
"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/#####/Firebase/Dev/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
Solution 3 file structure:
For me, the issue was with the node version that xcode was using. My project was building fine in Expo but not in Xcode after ejecting. I found my answer here:
check you have the latest version of node
$ node --versiondelete the version in /usr/local/bin/
$ rm /usr/local/bin/nodere add a sym link
$ ln -s $(which node) /usr/local/bin/node
Restart worked for me... Mac OS restart, not xCode restart...
I had a similar error
/{path to project root}/Pods/Target Support Files/Pods-{project name}/Pods-{project name}-frameworks.sh: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
In my case I had received a zip of a repo that included the Pods folder. It turns out that at some point between it being originally created and sent to me, the *.sh files in Pods/Target Support Files/Pods-{PROJECT}/ had all lost their execute permissions. Giving those files +x was the solution
For Example: chmod +x (File name in the error)
In my case: chmod +x Pods-TestExample-frameworks.sh
The reason
This build phase also lets you provide a list of input and output files. The script always runs when no input and output files are provided. When input and output files are provided, the script only runs if it has never been run before, one of the input files has changed, or one of the output files is missing
If you are using cocoapods, you may not be required to have an additional run script .
The solution
So the solution is remove the script as follows:
In my case the error was caused by the lack of space on my machine. Deleting old builds fixed the problem.
try this step if you need: Xcode 11.5 1- open terminal: cd Path_project 2- cd pod clean 3- pod install
if nothing change make this step
1- open Build Phases for target -> [CP] Embed Pods FrameWork check this field
In Xcode 12.4, after hours of try found the solution to this.
Go to Target > Architectures
Set Build Active Architecture Only to YES
and Excluded Architectures to x86_64
Another reason for the error might be is that Xcode is running a script during the run phase.
If this is the case, you have 2 options:
Delete the script (makes sense if the script is NOT important)
Modify/update the scripts location path (Xcode might not be able to locate the script)
In my case, the script was important, so I modified/updated its location.
Originally, the script location path was written like this:
$SRCROOT/scripts/clean-assets.sh
Because the scripts path contained spaces (I moved the project to a new directory), I changed the path to this:
"$SRCROOT"/scripts/clean-assets.sh
By adding quotes to SRCROOT, changing it to "$SRCROOT", the error will go away.
If you are doing Unity Project. You can get this error.
Command PhaseScriptExecution failed with a nonzero exit code
The solution is very simple
Pre-requisites: Have cocoapods installed
Not Needed: 1. Install "cocoapods"
for installing run following line in your terminal: $sudo gem install cocoapods
- Open your project folder using terminal
- Run this line:
chmod +x MapFileParser.sh - Run this line:
chmod +x process_symbols.sh
It worked for me)
I think that installing "cocoapods" is not necessary, only step 3 and 4 enough to solve, but it does not work, you can try it.
If you experience this issue in flutter. Try running the application on a real iPhone device from other IDE like android studio or vs code.
The issue was flutter SDK missing iOS-profile-release.
So by running the flutter command
flutter run
It downloads the missing things before running and this solves the problem.
For Xcode 11, React Native development environment. I usually have this problem when a dependency is not updated.
You can try following these steps, this usually works for me:
1- Delete your Podfile.lock (I like to use the command '-rm -rf Podfile.lock' on the terminal for this)
2- Delete your Pods folder (I like to use the command '-rm -rf Pods' in the terminal for this)
3- Delete your .xcworkspace
4- Pod install
5- Clear your project into XCode> Product> Clean Build Folder
I have a project in React Native and suddenly this error appeared. I was doing something with homebrew beforehand and this solved the issue for me:
brew update
brew upgrade
brew cleanup
solution for me, none of these arch -x86_64 pod install and etc does not work until I did these steps:
run sudo gem install ffi in terminal.
then run
arch -x86_64 pod installand build again.
and worked fine.
By mistake I had uninstalled carthage from my system. Adding that fixed the issue for me.
Step 1: Download & install latest carthage DMG here: Carthage
Step 2:
carthage update --platform iOS --cache-builds
Step 3: Run project & enjoy. :)
I tried everything above nothing worked for me it was a space in a folder name
/swift files/project a/code.xcworkspace ->
/swift_files/project_a/code.xcworkspace
did the trick If I looked deeper it was stopping at /swift
I got the error while using react-native-config.
Got this error since I had an empty line in .env files...
FIRST_PARAM=SOMETHING
SECOND_PARAM_AFTER_EMPTY_LINE=SOMETHING
3 hours wasted, maybe will save someone time
For me the reason was while changing name of app I added a single quote ' in name. I tried different solution and ran into different errors, but at last, while renaming app, I did not include ' single quote and it solved the problem.
For me, the issue was with Sentry.
- in Xcode navigate to
targets->Build Phases - delete the
Upload Debug Symbols to Sentryphase - clean the build folder and try the build again
I used flutter to create iOS project. When build for Simulator, failed with the same error message. It is solved by following work.
xCode 12.3 Build Settings->Build Active Architecture Only, set it to Yes.
I was able to resolve this error by remove file in Pods -> Targets Support Files -> Pods-AppName -> Pods-AppName-frameworks.sh. After removing that file again install pod using command pod install.
OR.
Try this:
-> quit xcode -> install pod(again) -> start xcode
Take Pods-resources.sh from project path and paste in Terminal
sudo chmod a+x "Pods-resources.sh file path here"
Example Usage:
sudo chmod a+x "/Users/path/Desktop-path/My Work-path/Pods/Pods-resources.sh"
In my case I have removed Run Script from the Build Phase in XCode.