Reputation: 116
I am getting Command PhaseScriptExecution failed with a nonzero exit code
error frequently, The below workarounds which I followed but didn't help me.
Workaround1: Keychain Access -> Right-click on login -> Lock & unlock again -> Clean Xcode project ->Make build again
Workaround2: Build Phases -> Targets -> Embedded pods frameworks "Run script only while installing"
Workaround3: Deleting the derived data
Workaround2: Clean project and building again.
Find the below log
Library/Developer/Xcode/DerivedData/CompanyName-
bofekdusvsoagmhinknpcoyjfyoj/Build/Intermediates.noindex/CompanyName.build/Debug-
iphonesimulator/company-iOS.build/Script-2AD2DCB21F0D6514005CEF4D.sh: line 2: 20846
Segmentationfault: 11 ../BuildSupport/swift_lint_check.sh
Upvotes: 6
Views: 16901
Reputation: 59
It might happen because of a few reasons, as the different answers suggest. If none of those worked, check if the ports used by Metro (like 8081) are busy. Restarting your computer might also be a good start. Then clean the build folder (Product -> Clean Build Folder) and build again.
In my case I was running on my laptop a server which used the port 8081, that's when I got the error as I was launching my Xcode app.
Upvotes: 0
Reputation: 11
4 days I tried to find a solution regarding "Command PhaseScriptExecution failed with a nonzero exit code" on M1, and in the end, I found the solution.
Save your time by following these steps:
But in my case, I had to delete my project and re-clone it from the Github repository before opening the project.
Let me know if this method works wkkwkw.
Upvotes: 1
Reputation: 1288
If this issue is caused by Firebase Crashlytics try removing all spaces from the project path.
I faced the same issue and tried all solutions and workarounds and nothing worked.
With Workaround2: Build Phases -> Targets -> Embedded pods frameworks "Run script only while installing" I only managed to build the project but not to archive it in order to upload to the app store. This made me sure that the issue was with one of the pods embedded there.
After a bit of trial and error, I discovered that the Firebase Crashlytics framework was the cause of the problem because the folder in which I had the Xcode project had two words with a space between. All I had to do was to move the project into a new folder that had no space anywhere in its path
Upvotes: 0
Reputation: 522
It was funny, it was due to wifi switched off in my case. When i switched on the wifi and run again the build got succeed.
Upvotes: -1
Reputation: 17902
I have faced the same issue in Xcode 13. I have updated the Crashlytics SDK after that I got the same issue. In my case I have followed the Solution2
Solution1:
I have removed the data from Run Script.
-> Targets ->go to Build Settings ->Click Run Script -> Remove data
Solution2:
If script is mandatory to your project just select install builds only option.
Select Check box For install builds only option
Upvotes: 3
Reputation: 11
Try the following steps:
See this image for reference:
Upvotes: 1
Reputation: 602
This may happen when you click "Deny" on Keychain access dialog, after this, you can make Workaround1 and then try to restart your Mac.
Also not forget to use the latest version of swiftlint and pods, make pod update SwiftLint
. After the restart, you can try to make:
$ sudo gem install cocoapods-deintegrate cocoapods-clean
$ pod deintegrate
$ pod clean
Upvotes: 2