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-iphonesimulator/Contigo.app/Frameworks

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/Contigo.app/Frameworks"

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'

Solution 1:

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

Build Phases

Solution 2:

Go to

  1. Keychain Access -> Right-click on login -> Lock & unlock again

  2. Xcode -> Clean Xcode project ->Make build again

Solution 3:

Run the following commands from the ios directory:

  1. pod deintegrate
  2. pod install
  3. XCode Clean build

Or, One-Liner:

pod deintegrate; pod install

Solution 4:

Xcode -> File -> Workspace Setting -> change Build System to Legacy Build System.

Note - Its not the ideal solution.

Solution 5:

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.