Xcode 11 Command PhaseScriptExecution failed with a nonzero exit code

Running Mojave 10.14.6

Xcode 11.0 (11A420a)

iOS 13.1.2

iPhone 6s Plus


I cannot seem to find the solution here or on Stack Overflow.


When compiling, I keep getting this error:


Command PhaseScriptExecution failed with a nonzero exit code


I tried in Xcode


Xcode > Preferences > Accounts

signing in and out


I have created a new Dev Cert, Distribution Cert, new PUSH certs, new provisional profiles


I have tried pod updates


I have tried changing the Build Phase info with chmod +x

as recommended by this post

https://forums.developer.apple.com/thread/122796?start=0&tstart=0


I have tried rebooting my phone. I have tried rebooting the computer. rebooting xcode (obviously)


Don't know what else to do.

Hey guys, I found the solution ( I can not confirm this is a long term solution) but allows you to archive the application without issues:

Search for the following line in your XCode project:

source="$(readlink "${source}")"

Now, replace all of its ocurrences with the following code:

source="$(readlink -f "${source}")"

That should do the trick while we get to know more about this issue.

Resolved - This worked for me Targets>App>General>Supported Destinations- Remove Mac

SCAM from Alquopi6 link!

Solution from @Alquopio6 worked for me, but yes, many ads.

Long story short - open Targets - [your target] - Build Phases - [CP] Embed Pods Frameworks - clean all the code, that you have in the field under /bin/sh

I know this looks strange, but check your Mac storage space. If you are missing space, Xcode reports a lot of different errors, but most of the time it doesn't report that disk space is low.

Here in 9/2023, this was simply a Cocoa pods bug for Archiving.

sudo gem update cocoapods

then do all the things.

The Error: "PhaseScriptExecution failed with a nonzero exit code" is a symptom not a root-cause. Trying blind fixes like multiple clean and Xcode project file manipulation will not necessarily fix your problem. As long as you do not really know what the problem actually is. In order to find the problem, in Xcode go to Report Navigator tab from left (last icon in Xcode 15) and select the Build that resulted in error. There you'll be able to see more about the actual error that is causing the PhaseScriptException. In my case I was getting this error on a Kotlin Multi Platform project and it was cause due to java incompatibility version between os and Gradle.

Nonthing from above didn't help me, but mac/iPhone restart helped

Seems like a lot of things can trigger this error. I just solved it for me (I'm using a free developer account) by Looking at XCODE->Settings->Accounts->Manage Certificates, and I saw a revoked certificate in the list. I deleted that, and my build succeeded.

for me, this issue is caused by my mac disk is full. This information was got by looking into the detail of build log, after navigating to the "Report navigator" in Xcode. there is much more concrete info what failed exactly

still facing the issue, mac m1 OS Sonoma, nothing else instead of "Command PhaseScriptExecution failed with a nonzero exit code" i do not have in logs.

Had a sane problem, turned out I had a syntax error in one of my tsx files.

jeffersonsb answer worked for me

Solved the problem looking at this video: https://youtu.be/FmZm0MeE5NE

Xcode 11 Command PhaseScriptExecution failed with a nonzero exit code
 
 
Q