Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode version 15.0 - Command PhaseScriptExecution failed with a nonzero exit code

I downloaded Xcode 15 and installed the iOS 17 updates.

When I try to build my Unity game on Xcode now, I get this error:

Command PhaseScriptExecution failed with a nonzero exit code

Any idea how to resolve this?

I have applied many solutions but nothing works yet.

like image 597
SteveGates Avatar asked Dec 01 '25 04:12

SteveGates


2 Answers

I just fixed the same issue!

I was installing Xcode 15 on my new machine M2 ( Apple Silicon ) so first of all, this is the general error message but you would need more details to understand the root cause of the issue.

Use the Xcode report navigator 🧐

To show the report navigator, either (1) click the rightmost button in the navigator bar at the top of the navigator area, which is on the left side of the workspace window, (2) select View > Navigators > Reports from the menu bar at the top of the screen, or press ⌘9.

After showing the report, I was able to identify the root cause which is Bad CPU type in executable as shown below:

Bad CPU type in the executable

So as I am using the M2 machine, I found the reason because when macOS tries to run an app that is not built for Apple silicon, macOS will prompt to install Rosetta 2 ( It enables a Mac with Apple silicon to use an app built for a Mac with an Intel processor. ) to automatically translate the app to Apple silicon but this did not automatically happen with my machine and maybe yours and also in Terminal, there is no automatic detection for missing Rosetta to run older architecture command line tools.

If you haven't been prompted for any other app already, manually install Rosetta 2:

softwareupdate --install-rosetta

Installing Rosetta 2:

enter image description here

Getting back to my Xcode and I was finally able to build the project successfully! It is simply because Xcode is one of the apps/tools that were originally designed for Intel-based Macs and are now translated by Rosetta 2 on Apple silicon Macs.

enter image description here

Good luck 🤞

like image 112
Essam Fahmi Avatar answered Dec 03 '25 18:12

Essam Fahmi


After updating Xcode to 15.0 I am facing this issue. I have found a workaround for this issue. Please try the following steps:

  1. Search for source="$(readlink "${source}")" in your project. I found it in Pods-[your-project-name]-frameworks.sh

  2. Change source="$(readlink "${source}")" to source="$(readlink -f "${source}")"

like image 23
DareDevil Avatar answered Dec 03 '25 17:12

DareDevil