Skip to content
Latchkey

CocoaPods "sandbox is not in sync with the Podfile.lock" in CI

Xcode found that the installed Pods directory does not match Podfile.lock. CI did not run pod install, or it ran with a different lockfile.

What this error means

The build fails with The sandbox is not in sync with the Podfile.lock. Run pod install. It reproduces until the Pods directory is regenerated to match the committed lockfile.

xcodebuild
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

Common causes

pod install was skipped in CI

The job built the workspace without installing Pods, so the Pods directory is stale or absent.

Podfile.lock changed but Pods were not regenerated

A dependency bump updated the lockfile while the checked-out or cached Pods reflect the old state.

How to fix it

Run pod install before building

  1. Install Pods as a setup step so the sandbox matches the lockfile.
  2. Build the .xcworkspace, not the .xcodeproj, after installing.
shell
pod install --repo-update
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp build

Commit a consistent Podfile.lock

Regenerate locally with pod install, commit the updated Podfile.lock, and keep it in sync with the dependencies you intend to ship.

How to prevent it

  • Always run pod install in CI and commit Podfile.lock. Cache the CocoaPods spec repo to speed installs. On Latchkey managed runners, self-healing auto-retries transient pod fetch failures and larger runners speed up installs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →