Assistance Needed – Xcode: Command PhaseScriptExecution Failed with a Nonzero Exit Code

Main Issue: While building an iOS project using IL2CPP in Unity, I encountered the following error:

Command PhaseScriptExecution failed with a nonzero exit code Sub-Issue: Unity is unable to detect a compatible iPhoneOS SDK, even though Xcode is correctly installed and functioning as expected.

Error Message:

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.

More information and installation instructions can be found here:
https://developer.apple.com/support/xcode/

Specific Xcode versions can be downloaded here:
https://developer.apple.com/download/more/

Unable to detect any compatible iPhoneOS SDK! Additional Errors & Observations:

  1. bee_backend Not Found

chmod: /Users/vaunicacalji/Desktop/DinoKite/Il2CppOutputProject/IL2CPP/build/deploy_x86_64/bee_backend/mac-x86_64/bee_backend: No such file or directory Issue: Manually checking the file, bee_backend does exist and is executable, but the build process still reports it as missing. 2. IL2CPP Build Failure Build failed with 0 successful nodes and 0 failed ones
Error: Internal build system error. BuildProgram exited with code 1. 3. Xcode Not Detected by Unity Unable to detect any compatible iPhoneOS SDK! Issue: Running xcode-select -p confirms that Xcode is installed at /Applications/Xcode.app/Contents/Developer, and xcodebuild -showsdks lists available SDKs, including iOS 18.2. Environment Details: macOS Version: Sonoma 14.5 Mac Model: MacBook Air (Retina, 13-inch, 2018) Processor: 1.6 GHz Dual-Core Intel Core i5 Memory: 8GB 2133 MHz LPDDR3 Graphics: Intel UHD Graphics 617 1536MB Unity Version: 2022.2.21f1 Installed Unity Modules: ✅ iOS Build Support ✅ Mac Build Support (IL2CPP) ✅ IL2CPP Current Status & Key Issues: ✅ Xcode is properly installed, and xcode-select -p shows the correct path. ✅ xcodebuild -showsdks confirms that iOS SDK 18.2 is available. ✅ bee_backend is present and executable when checked manually. ❌ Unity still reports Unable to detect any compatible iPhoneOS SDK! during the build process. ❌ Unable to successfully build the iOS project.

Could you please provide guidance on how to resolve this issue?

Xcode Build Settings (for reference): ALWAYS_SEARCH_USER_PATHS = NO ARCHS = arm64 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon CLANG_CXX_LANGUAGE_STANDARD = c++0x CLANG_CXX_LIBRARY = libc++ CLANG_ENABLE_OBJC_ARC = YES CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Distribution CODE_SIGN_IDENTITY[config=Debug] = Apple Development CODE_SIGN_IDENTITY[config=Release] = Apple Distribution CODE_SIGN_STYLE = Manual DEVELOPMENT_TEAM[sdk=iphoneos*] = 4429TL28T7 IPHONEOS_DEPLOYMENT_TARGET = 15.6 LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks PRODUCT_BUNDLE_IDENTIFIER = com.torihiplay.DinoKite PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*] = DinoKite. SDKROOT = iphoneos SUPPORTED_PLATFORMS = iphoneos TARGETED_DEVICE_FAMILY = 1,2 UNITY_RUNTIME_VERSION = 2022.2.21f1 UNITY_SCRIPTING_BACKEND = il2cpp This build is intended for a production release.

I would appreciate any help in resolving this issue. Thank you!

Thank you for reporting the issues you have encountered while building your iOS project using IL2CPP in Unity. I recommend posting at the 3rd party support channel, as Unity may be aware of the issue.

I can only address the Xcode issue related to missing when trying to compile.

It appears that Xcode may not be installed correctly or in the Application folder.

  • Unable to detect compatible iPhoneOS SDK:
    • Verify that Xcode is set as the active developer tool using xcode-select —switch /Applications/Xcode.app.
    • Ensure that you have the correct Xcode version installed. IL2CPP requires Xcode 9.4 or later for Apple Silicon. You should download the latest from the App Store.
    • Restart your Mac after making any changes.
  • Xcode Not Detected by Unity:
    • As you have mentioned, xcode-select -p confirms that Xcode is installed in the correct location.
    • Try restarting your Mac.

Additional Steps:

  • Update your Unity version to the latest stable release. Sometimes, issues can be resolved by updating to a newer version. I recommend checking with Unity themselves.
  • Check for any conflicts with third-party packages or plugins in your Unity project. Temporarily disable them and see if the build process works.

Please provide an update after trying these steps. If the issue persists, I recommend checking with Unity support.

Albert Pascual
  Worldwide Developer Relations.

Assistance Needed – Xcode: Command PhaseScriptExecution Failed with a Nonzero Exit Code
 
 
Q