Error “Missing package product“ for Swift Packages (SPM)

See how to fix the “Missing package product“ error in Xcode caused by some Swift Packages added through SPM.

Francesco Leoni

2 min read

Error

Missing package product <package name>

Problem

Have you added some Swift Packages and, after that everything worked perfectly, Xcode thrown this error?

After multiple attempts, I found this solution that worked perfectly.

Solution

  1. Close Xcode
  2. Open Terminal where the directory of your .xcodeproj is
  3. Run xcodebuild -resolvePackageDependencies
  4. Check, if any, which Swift Package is throwing an error
  5. Then, open Xcode and downgrade the Swift Package that is causing the problem to the previous version
  6. Clean, build and check if the error is gone
  7. Then, if you can't use earlier versions of the library, try reinstalling the latest version. It may work again.

In my case, the Swift Package that was causing the error was FirebaseFirestore.

This is the result of xcodebuild -resolvePackageDependencies.

Command line invocation:

/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies

User defaults from command line:

IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph

checksum of downloaded artifact of binary target 'FirebaseFirestore'

(4a0070c4bf7e5ab59359dd8a0e68f402f3ec6c1e189fc39cc44ca88418f26ac4) does not match checksum

specified by the manifest (bb362e131fda776d6911e553516439fe7d3744a213c6720ee9d58ebc5b6de789)

Resolved source packages:

NetworkingInterface: (null)

2023-05-18 15:41:11.800 xcodebuild[4261:25804] Writing error result bundle to /var/folders/f9/yqxrfs4d3jbb047fxtkn918m0000gp/T/ResultBundle2023-18-0515-41-0011.xcresult

fatalError

xcodebuild: error: Could not resolve package dependencies:

checksum of downloaded artifact of binary target 'FirebaseFirestore'

(4a0070c4bf7e5ab59359dd8a0e68f402f3ec6c1e189fc39cc44ca88418f26ac4) does not match checksum specified by the manifest (bb362e131fda776d6911e553516439fe7d3744a213c6720ee9d58ebc5b6de789)

fatalError

As you can see the checksum of downloaded artifact of binary target 'FirebaseFirestore' does not match checksum specified by the manifest.

This was blocking Xcode from resolving the package dependencies.

Alternative solutions

  • Discard changes under git
  • Clean project
  • Clean derived data
  • Resolve Package Versions (File > Packages)
  • Reset Package Cache (File > Packages)
  • Update to Latest Package Versions (File > Packages)
  • Restart Xcode
  • Restart Mac

Conclusion

Hope this will fix your issue.

If you have any question about this article, feel free to email me or tweet me @franceleonidev and share your opinion.

Thank you for reading and see you in the next article!

Share this article

Related articles


CloudKit With CoreData Not Working in Production

Discover why sometimes the sync between CoreData and CloudKit do not work in production but it does while developing.

1 min read

Q&AErrors

Error “No such file or directory“ for 3rd Party Libraries

See how to fix the “No Such File or Directory“ error in Xcode. It can be frustrating to debug since it can have multiple causes.

1 min read

Q&AErrors

Error “Missing file libarclite“ (Xcode 14.3)

See how to fix the “Missing file libarclite“ error in Xcode. This is due to libraries with minimum deployment target of iOS 11.

1 min read

ErrorsQ&AXcode