Skip to content
Latchkey

pod install: CocoaPods Dependencies in CI

pod install installs the exact pods pinned in Podfile.lock and generates the .xcworkspace; pod update is what changes versions.

CocoaPods trips CI in two classic ways: a stale spec repo and a Podfile.lock that does not match the Podfile. Knowing that install respects the lockfile while update rewrites it saves most of the debugging.

What it does

pod install reads the Podfile and Podfile.lock, downloads the locked pod versions, and integrates them into an Xcode workspace. pod update ignores the lock and resolves to the newest allowed versions. pod repo update refreshes the local copy of the spec repositories.

Common usage

Terminal
pod install
pod install --repo-update        # refresh specs, then install
pod install --deployment         # CI: fail if the lockfile would change
pod _1.15.2_ install             # pin the CocoaPods version via the gem
pod cache clean --all

Options

Flag / commandWhat it does
--repo-updateUpdate the spec repos before installing
--deploymentError if install would modify the Podfile.lock (CI-safe)
--clean-installForce re-download even if cached
pod repo updateRefresh the spec repositories
pod cache clean --allClear the CocoaPods download cache
pod _<version>_ installRun a specific installed CocoaPods gem version

In CI

Use pod install --deployment so the build fails loudly if Podfile.lock is out of date instead of silently mutating it. Cache ~/Library/Caches/CocoaPods and the Pods/ directory keyed on Podfile.lock to cut minutes off each run. Pin the CocoaPods gem version to match what generated the lockfile.

Common errors in CI

"The sandbox is not in sync with the Podfile.lock. Run pod install" means the lockfile and installed Pods disagree; run pod install (and commit the result) or use --deployment to catch it early. "Unable to find a specification for ..." means a stale spec repo; add --repo-update. "CDN: trunk Repo update failed" is a transient CocoaPods CDN issue; retry or run pod repo update. A Ruby version mismatch surfaces as a bundler/gem error before pod even runs.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →