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.
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:

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:

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.

Good luck 🤞
After updating Xcode to 15.0 I am facing this issue. I have found a workaround for this issue. Please try the following steps:
Search for source="$(readlink "${source}")" in your project.
I found it in Pods-[your-project-name]-frameworks.sh
Change source="$(readlink "${source}")" to source="$(readlink -f "${source}")"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With