Swift Package Manager hangs while Xcode resolves packages
swift package resolve does not returnShort answer
When package resolution hangs, first run the same resolve from the terminal so you see real output. Then work through the cache and the lock file: purge SwiftPM's global cache, reset the package's own build directory, and check that Package.resolved matches Package.swift.
Fix it fast
1Find out which cause you have
Run the resolve outside Xcode. The terminal shows which package it is stuck on, which the Xcode status bar does not.
cd path/to/your/package swift package resolve --verbose2Match what you see, then jump to its fix
- 1
The verbose output stops or repeats on the same package.A stale or half-filled package cacheFix - 2
Resolution starts only after a pull, a branch switch or a version-rule edit.Package.resolved disagrees with Package.swift or with a teammate's commitFix - 3
The terminal resolves fine but the Xcode project still shows packages unresolved.Xcode itself needs to be told to resolve againFix
- 1
What does the error look like?
swift package resolve does not returnPackage resolution never finishes in Xcode
Cause 1 of 3
A stale or half-filled package cache
1Check
SwiftPM keeps a global repository cache. Apple and the SwiftPM docs offer two cleaners: purge-cache for the global cache, reset for the package's own cache and build directory.
swift package purge-cache --verbose2Fix
Purge the global cache, reset the package, then resolve again. Expect the next resolve to download everything again.
swift package purge-cache
swift package reset
swift package resolve3Verify
resolve exits with no error.
swift package resolve && echo resolvedConfirmed by raw.githubusercontent.com
Cause 2 of 3
Package.resolved disagrees with Package.swift or with a teammate's commit
1Check
Resolve keeps recorded versions while they stay eligible, and a changed Package.resolved makes the next resolve move dependencies to match it. Look at what changed in the file.
git log -p -n 3 -- Package.resolved2Fix
Resolve against the recorded versions only, or move everything to the newest eligible versions with update, which also rewrites Package.resolved.
swift package resolve --force-resolved-versions
# or, to take newer eligible versions:
swift package update3Verify
Package.resolved is stable: a second resolve changes nothing.
swift package resolve
git status --short Package.resolvedConfirmed by raw.githubusercontent.com
Cause 3 of 3
Xcode itself needs to be told to resolve again
1Check
Xcode updates and resolves packages on its own, and you can trigger both from the File > Packages menu. Xcode's lock file for an app project sits inside the project.
find . -name Package.resolved -not -path './.build/*'2Fix
In Xcode choose File > Packages and run the resolve action, then update if you want newer versions.
# Xcode menu: File > Packages, then the resolve action
# file used by the project:
# YourApp.xcodeproj/project.workspace/xcshareddata/swiftpm/Package.resolved3Verify
The Swift Package Dependencies section in the Project navigator lists every package with a version.
ls YourApp.xcodeproj/project.workspace/xcshareddata/swiftpm/Confirmed by developer.apple.com
How do I stop it coming back?
- Commit Package.resolved so everyone resolves the same versions.
- Prefer version-based requirements over branch or commit rules.
- Resolve once in the terminal after changing dependencies, so a network problem shows up as text, not as a spinner.
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?
Projects of mine built on the same technologies:
Related fixes
Mobile apps
UserDefaults logs 'Failed to read values in CFPrefsPlistSource' for an app group
Settings saved by the app are not visible to its extension, widget or sibling app that share the group
This log comes from the preferences system when UserDefaults is opened for an app group's suite.
3 causes, each with a fixMobile apps
iOS app crashes: Google Maps SDK must be initialized via provideAPIKey
Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use
The Maps SDK throws this when a Maps object is created before GMSServices.provideAPIKey has run.
3 causes, each with a fixMobile apps
UIKit app crashes because it cannot find the storyboard
Could not find a storyboard named 'Main' in bundle NSBundle
UIStoryboard throws this exception when no storyboard file with that name exists in the bundle it searches.
3 causes, each with a fixMobile apps
Firebase on iOS asks for the FCM token before APNs has given one
Be sure to re-retrieve the FCM token once the APNS device token is set.
The Firebase Messaging SDK needs the APNs device token from iOS before it hands out an FCM token.
3 causes, each with a fixMobile apps
A test push from the Firebase console never shows up on the iPhone
didReceiveRegistrationToken prints a token, yet no notification arrives
When a console message is accepted but the iPhone stays silent, the break is between Firebase and APNs or inside the app.
4 causes, each with a fixMobile apps
InstanceID token() no longer works in a Swift Firebase app
Instance ID calls fail to compile after upgrading Firebase to 8.0.0 or later
Firebase removed the Instance ID dependency from Messaging in 8.0.0, so InstanceID.instanceID() calls no longer belong in a current app.
3 causes, each with a fix