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

12

11

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.

Mellifluous answered 20/9, 2023 at 11:13 Comment(3)
I am following the next bug issue for fixing but need to update my game tomorrow. forum.unity.com/threads/…Mellifluous
I got the same issue after upgrading to 15.1, and the answer doesn't work at allGallantry
Make sure that the project path contain any whitespaces, i.e in folder name. i faced this issue due to white space in path to project folder.Barbule
Z
15

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}")"

Zymometer answered 1/11, 2023 at 13:31 Comment(2)
If it was a flutter project, flutter should have fixed that on their own. When I looked for that, it was already there.Gerfen
github.com/facebook/react-native/issues/… This helps me to locate the place quickly.Parrot
C
11

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 🤞

Comeon answered 11/1 at 18:10 Comment(5)
strange but worked for me. Thanks.Petrozavodsk
window, (2) select View > Navigators > Reports from the menu bar at the top of the screen, or press ⌘9. This is the most valuable part of all the nonzero exit code reports on the internet. Thanks!Gerfen
Thanks, the report navigator gave more info and it helped me a lot. I had the same error message. I wanted to run a React app with Expo which uses the 8081 port, but that port was already taken by an other app running on my machine. Closing the other app solved the issue.Lucier
In my case it was missing swiftlintDecare
I dont know why, the code was working in my M1 pro laptop. Then I did factory reset setup everything then it stopped working. As soon as I installed Rosetta 2 and did clean build the code started working. Thanks a lotKaolin
V
4

I came across the same error & the solutions I found did not work. However on other projects the builds did actually worked but not on my new project. So i compared both projects and changed 2 elements and it works now!

1: .xcode.env.local

Location: app/ios/.xcode.env.local

I changed this

export NODE_BINARY="/opt/homebrew/Cellar/node/20.8.1/bin/node"

into this

export NODE_BINARY="/usr/local/bin/node"

2. Build Settings

update the Xcode project build option 'ENABLE_USER_SCRIPT_SANDBOXING' to 'No'. enter image description here

After doing this, the application could be built!

Vezza answered 14/12, 2023 at 9:23 Comment(3)
Could you explain part 1 in more details, please?Manna
Instead of locating to a NODE_BINARY that was installed by Homebrew, it looks to a NODE_BINARY that was installed via npmVezza
I ran into this issue as well and found out it was because the .xcode.env.local file was pointing to a node.js version I had recently removed from my machine.Nero
A
1

Here is my resolve (downgrade Xcode): Uninstall Xcode 15, then go to system settings of store, turn off auto update, then download old version of Xcode: https://developer.apple.com/download/all/ choose your old version which work for your work. Double click download file (.xip) to install then drag it to Apllication folder.

Abydos answered 23/9, 2023 at 7:59 Comment(1)
I (and many others) also did this, but this is of course no real solution to the problem....Emrick
C
1

Upgrading to Unity version 2022.3.16f1 fixed it for me.

Catechist answered 8/1 at 17:48 Comment(1)
I also experienced the same issue, but upgrading to Unity version 2022.3.16f1 resolved it for me.Stuff
L
0

After updating Xcode to 15.0 I am facing this issue. I have found a workaround for this issue. Please try following step - it works for me with Xcode ver 15.2.

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

Lordship answered 1/2 at 15:58 Comment(3)
This is the opposite of the answer that currently has the highest upvotes which states that the -f needed to be added.Clarissa
it is not working for me :(Police
This comment is the opposite of what worked. The correct answer was given by @Zymometer above.Regiment
C
0

If you are developing the FLUTTER app, then try the below commands

     flutter clean
     flutter pub get

     cd ios
     pod install
     flutter build ios

once ios build is successfully done, then proceed with release steps in Xcode.

Cantus answered 6/2 at 8:52 Comment(0)
M
0

For React Native .74 - MAC M3

npx react-native-clean-project
cd ios && pod deintegrate
npx pod-install
npx react-native start --reset-cache
Metasomatism answered 27/6 at 8:19 Comment(0)
I
0

I am using Xcode v15.4 and react-native v0.73.6, and I got the same error when I tried to run it on my real device, It was working fine in the simulator. By following the steps below it fixed for me. You can try this fix if you are using any xcode v15.x

Xcode: 15.4

react-native: 0.73.6

macOS: 14.5 (23F79) M1 Chip

Steps:

  1. From your react-native project navigator go to ios folder
  2. Select [Your app name].xcodeproj folder
  3. Select project.pbxproj
  4. Search for arm64
  5. You will get it at 3 places
  6. Remove all 3 lines with arm64
  7. Clean and build the project again

Hope this will fix your issue and save your day!

Interstellar answered 15/7 at 22:4 Comment(1)
Couldn't find it.Goldshell
M
0

For me(running Xcode 15.0.1, not using RN or other libraries), the only way I finally got it working is Removing Pods/*, podfile.lock and rerunning pod install. All the others like setting -e to +e, editing in readlink did nothing to me.

Macrography answered 16/7 at 9:6 Comment(0)
S
-2

This must be a joke, because I used a space in the parent folder name and it got fixed when I remove

../React Native/project -> ../ReactNative/project

Shipley answered 21/2 at 3:52 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Energumen
B
-3

To address the issue related to architecture, you can update the build settings as follows:

  1. Open your Xcode project.
  2. Navigate to the project settings by selecting your project in the Project Navigator.
  3. Choose your target under the "Targets" section.
  4. Go to the "Build Settings" tab.
  5. Search for the specific build setting mentioned in the provided instructions.
  6. Modify the value according to the instructions provided. Save your changes.

By following these steps, you should be able to update the build settings as required."

enter image description here

This should help resolve the issue you're encountering. If you have any further questions or need clarification on any step, feel free to ask!

Baroscope answered 10/4 at 15:36 Comment(1)
1) Your steps 5 and 6 mention "provided instructions". What instructions are you referring to? Please clarify your answer. 2) What architecture related issue are you referring to? The question does not make any mention of an architecture issue.Clarissa

© 2022 - 2024 — McMap. All rights reserved.