Xcode: Command PhaseScriptExecution failed with a nonzero exit code
A Run Script build phase (CocoaPods, React Native, Flutter, SwiftLint, Crashlytics…) failed. The real error is above this line in the build log.
Seen on:
iOS
Meaning
Xcode only reports that a script failed. Open the Report navigator, expand the failing “Run custom shell script” step and read its output.
Common causes
- CocoaPods out of sync (
Pods/Manifest.lockmismatch) - Node not found by Xcode (React Native) — PATH differs from your shell
- Flutter/Dart tool path or version issues
- Script lacks execute permission or has CRLF line endings
- User Script Sandboxing (Xcode 15+) blocking file access
⚡ Quick fix
- Expand the failing step in the Report navigator
cd ios && pod install- React Native: set
NODE_BINARYinios/.xcode.env.local - Try
ENABLE_USER_SCRIPT_SANDBOXING = NOfor scripts that need file access - Clean build folder (⇧⌘K) and DerivedData
Detailed fix by platform
iOS
- React Native Node path:bash
echo "export NODE_BINARY=$(command -v node)" > ios/.xcode.env.local cd ios && pod install
How to diagnose
- Script — Which build phase failed?
- Output — What did it print before exit?
- Environment — PATH/tools visible to Xcode?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026