Skip to content
Latchkey

xcodebuild "Could not resolve package dependencies" in CI

When you build an Xcode project or workspace, Xcode runs its own SPM resolution. This error means that resolution failed: an unreachable or private package, a stale pin, or a Package.resolved that no longer matches.

What this error means

xcodebuild fails with "error: Could not resolve package dependencies" (or "Package.resolved ... unable to resolve"), often after a scheme or dependency change.

xcodebuild
xcodebuild: error: Could not resolve package dependencies:
  failed to resolve dependencies for 'MyApp': the package 'Networking' at 'git@github.com:acme/networking.git' could not be cloned

Common causes

A private package without runner credentials

Xcode's resolver cannot clone a private SPM dependency because no SSH key or token is available on the runner.

A stale or missing resolved pin

The workspace Package.resolved points at a revision that changed or was removed, so integrated resolution cannot honor it.

How to fix it

Resolve packages explicitly with credentials

  1. Provide SSH/token auth for private packages before building.
  2. Run xcodebuild -resolvePackageDependencies as its own step to surface failures early.
  3. Then build the scheme.
Terminal
xcodebuild -resolvePackageDependencies \
  -scheme MyApp -clonedSourcePackagesDirPath SourcePackages

Refresh the resolved pins

If a pinned revision changed, update and commit Package.resolved, then rebuild.

Terminal
xcodebuild -resolvePackageDependencies -scheme MyApp
git add MyApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

How to prevent it

  • Run -resolvePackageDependencies as a distinct CI step before the build.
  • Commit the workspace Package.resolved for reproducible resolution.
  • Configure private package auth before Xcode resolves.

Related guides

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