Xcode 14: Command PhaseScriptExecution failed with a nonzero exit code

After updating Xcode to the version 14.0, I got this error using:

Ionic CLI : 6.20.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.6.11
@angular-devkit/build-angular : 12.0.5
@angular-devkit/schematics : 12.1.1
@angular/cli : 12.0.5
@ionic/angular-toolkit : 4.0.0

Capacitor CLI : 3.1.1
@capacitor/android : 3.1.2
@capacitor/core : 3.1.1
@capacitor/ios : 3.1.1

Command PhaseScriptExecution failed with a nonzero exit code

I found the solution on the StackOverflow site: flutter - Xcode 14: Command PhaseScriptExecution failed with a nonzero exit code - Stack Overflow

Search for the following line in your project, it must be in ios/Pods/Target Support Files/Pods-{app_name}/Pods-{app_name}-frameworks.sh,
source=“$(readlink “${source}”)”, replace:

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

It worked.
But what is the meaning of this line and “- f”?

This is a CocoaPods bug on Xcode 14, it has been fixed on CocoaPods 1.12.1.
What you found on the flutter issue tracker was a workaround until CocoaPods got updated, you don’t need to do the workaround, but to update CocoaPods.

How could I update CocoaPods?

how did you install it?
If you installed it using homebrew, then you can run

brew update
brew upgrade cocoapods

If you installed it using gem, then run gem install cocoapods again

If you installed it in a different way, then not sure, check the instructions about updating for the package manager you used.

1 Like

It’s been a long time since I’ve done these installations. I update only what is mandatory to avoid problems in my projects. I believe I used gem. I will try it.
Many thanks.

My solution was to use Xcode 14.2 witch work better for doing the build and archiving. You can downgrade your version of Xcode downloading this version from the apple developer’s site here:


If you can upgrade capacitor to the last stable version also help