Xcode Command PhaseScriptExecution failed with a nonzero exit code

1.Problem description

Use Xcode to write code. During the process of compiling new project code, the following error has been reported all the time.

Command PhaseScriptExecution failed with a nonzero exit code

After searching on the Internet, most of the solutions given on the Internet are as follows. However, after I tried, the problem was not solved, but more errors were reported. Therefore, I asked my tutor and finally got the solution.

When running a project, I encountered this bug prompt. I can’t compile it all the time. This is actually a bug caused by xcode10. Solution: in the Xcode menu bar, select File – > Workspace Setting -> Build system select legacy build system to run again.

The main reason for this problem is that the workspace is full, which leads to errors in code compilation. There are two ways to solve this problem.

(1) Enter Xcode’s code work cache folder for manual cleaning (error prone, not recommended)

(2) Just use the cleaning method provided by Xcode. After Xcode cleans up the workspace, it will automatically link the working files (no error, recommended)

Because the second method is relatively easy to operate and is unlikely to make mistakes, we directly use this method to solve the problem.


1. First, in product – > Select the main code module of the current project in scheme

2. Select product – > Clean build folder cleans up the workspace

3. Recompile the project code later

Similar Posts: