Xcode build fails: 'The sandbox is not in sync with the Podfile.lock'
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.Short answer
A build phase named Check Pods Manifest.lock compares Podfile.lock with Pods/Manifest.lock and stops the build when they differ. That means the Pods folder was installed from a different Podfile.lock than the one now in your project. Run pod install from the Podfile folder, then build from the workspace.
Fix it fast
1Find out which cause you have
Run the same comparison the build phase runs. If it prints differences, the two lockfiles disagree.
diff Podfile.lock Pods/Manifest.lock2Match what you see, then jump to its fix
- 1
The error follows a git pull, a branch switch or an edit to the Podfile.The Podfile or Podfile.lock changed and pod install was not runFix - 2
Works on your Mac, fails in CI or on a new machine where Pods/ is not committed.CI or a fresh clone builds without installing podsFix - 3
Podfile.lock is missing, or two different copies exist.The lockfile is not committed, or pod install ran in the wrong folderFix
- 1
What does the error look like?
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.Command PhaseScriptExecution failed with a nonzero exit code
Cause 1 of 3
The Podfile or Podfile.lock changed and pod install was not run
1Check
The diff shows pods with versions in one file and not the other.
diff Podfile.lock Pods/Manifest.lock2Fix
Run pod install. It installs the versions recorded in Podfile.lock, which is what the team shares. Do not use pod update here, it ignores the lockfile and moves versions.
pod install3Verify
The diff is empty and the build passes.
diff Podfile.lock Pods/Manifest.lock && echo in syncConfirmed by guides.cocoapods.org
Cause 2 of 3
CI or a fresh clone builds without installing pods
1Check
If Pods/ is in .gitignore and the pipeline has no install step, Pods/Manifest.lock does not exist and the comparison fails.
git check-ignore -v Pods
ls Pods/Manifest.lock2Fix
Add pod install before the build step, or commit the Pods folder. CocoaPods supports either choice, but Podfile and Podfile.lock must always be committed.
pod install
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp build3Verify
The build phase passes in CI.
ls Podfile.lock Pods/Manifest.lockConfirmed by guides.cocoapods.org
Cause 3 of 3
The lockfile is not committed, or pod install ran in the wrong folder
1Check
The build phase reads Podfile.lock from the Podfile directory. If the lockfile is untracked, each machine creates its own.
git ls-files Podfile.lock
find . -name Podfile.lock -not -path './Pods/*'2Fix
Run pod install in the folder that holds the Podfile, then commit Podfile.lock.
cd path/to/podfile-folder
pod install
git add Podfile.lock3Verify
git shows Podfile.lock tracked, and the diff is empty.
diff Podfile.lock Pods/Manifest.lock && echo in syncConfirmed by guides.cocoapods.org
How do I stop it coming back?
- Always commit Podfile and Podfile.lock.
- Make pod install the first step after git pull in your team's checklist, and the step before every CI build.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Mobile apps
Xcode says a script phase failed, but not which one or why
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
This line only reports that one Run Script build phase exited with an error.
4 causes, each with a fixMobile apps
Cannot change the App Privacy answers in App Store Connect
Publish Your App Privacy Responses?
Only the Account Holder, Admin and App Manager roles can answer the App Privacy questions.
2 causes, each with a fixMobile apps
App record creation fails because you lack permission
You cannot add a new app in App Store Connect as a Developer or limited user
Only the Account Holder, an Admin or an App Manager can create an app record, and Apple blocks it until the Account Holder has signed the latest agreement.
3 causes, each with a fixMobile apps
You cannot find the button to pull your app back from review
No 'remove this version from review' message appears on the version page
There is no button called Reject Binary.
3 causes, each with a fixMobile apps
Your Apple Account cannot sign in to App Store Connect
Sign-in to App Store Connect is refused for an account that should have access
App Store Connect does not open to every Apple Account.
3 causes, each with a fixMobile apps
Apple rejected the app under Guideline 4.3, Design: Spam
Guideline 4.3(b) - Design - Spam
Guideline 4.3 is Apple's duplicate rule.
5 causes, each with a fix