Command PhaseScriptExecution failed with a nonzero exit code

Hello, I see that others have had this problem, but I don't see any answers. I am making an IOS build in Unity and when I run it in Xcode Xcode 15.4, on macOS 14.6.1, I get the error above.

Following the advice of Apple help, I re-installed CocoaPods to the latest version and installed Unity dependencies. This resulted in failure with same message.

If I add Firebase using nano Podfile, I get a different failure code, (FirebaseCoreInternal: HeartbeatsPayload - no such module) Build still doesn't work. Any suggestions much appreciated

Answered by DTS Engineer in 822983022

Command PhaseScriptExecution failed with a nonzero exit code means that your Xcode project has a build phase containing a shell script that is doing work customized to your project, and a command line tool called from within that shell script returned an exit code of something other than 0, which is convention for indicating a failure or error condition.

If you expand the contents of the build step that failed in Xcode — there is an icon with several horizontal lines on it on the right side of the build transcript when you click on the build step — you will get more information about the output of the shell script, and possibly the tool that your shell script called that failed or helpful error messages.

Once you know the name of the tool that failed in your shell script, you can work backwards from there to look identify which script build phase in your project failed, and debug the contents of that shell script. If you weren't able to identify the exact command that failed from looking at the expanded build log, you should look at each script build phase in your target and analyze it — you may only have 1 such build phase, so identification could be easy.

Many third-party tools will add script build phases to an Xcode project as part of their integration into your app development work. If you find that the build phase that failed came from a third-party tool that you depend on, you should consult with the vendor of that tool to review your configuration and understand what you can do to make sure that their script in your project always succeeds.

— Ed Ford,  DTS Engineer

Command PhaseScriptExecution failed with a nonzero exit code means that your Xcode project has a build phase containing a shell script that is doing work customized to your project, and a command line tool called from within that shell script returned an exit code of something other than 0, which is convention for indicating a failure or error condition.

If you expand the contents of the build step that failed in Xcode — there is an icon with several horizontal lines on it on the right side of the build transcript when you click on the build step — you will get more information about the output of the shell script, and possibly the tool that your shell script called that failed or helpful error messages.

Once you know the name of the tool that failed in your shell script, you can work backwards from there to look identify which script build phase in your project failed, and debug the contents of that shell script. If you weren't able to identify the exact command that failed from looking at the expanded build log, you should look at each script build phase in your target and analyze it — you may only have 1 such build phase, so identification could be easy.

Many third-party tools will add script build phases to an Xcode project as part of their integration into your app development work. If you find that the build phase that failed came from a third-party tool that you depend on, you should consult with the vendor of that tool to review your configuration and understand what you can do to make sure that their script in your project always succeeds.

— Ed Ford,  DTS Engineer

This is the specific error message: uild failed with 0 successful nodes and 0 failed ones

Error: Internal build system error. BuildProgram exited with code 1.

Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Mac, you must have Xcode installed.

Building for Apple Silicon requires Xcode 9.4 and Mac 10.12 SDK.

Xcode needs to be installed in the /Applications directory and have a name matching Xcode*.app. Or be selected using xcode-select.

It's also possible to use /Library/Developer/CommandLineTools if those match the listed requirements.

I am getting this message from xcode itself!

Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Mac, you must have Xcode installed.

That log is helpful, I'm glad you found it. This message helps identify that the source of the error here is Unity. Clearly, you have Xcode installed, so you should chat with Unity's support to figure out any configuration issues are present in your setup that is preventing you from fully using their software.

— Ed Ford,  DTS Engineer

Command PhaseScriptExecution failed with a nonzero exit code
 
 
Q