Xcode 13 "Missing package product" using local Swift Packages

I have a project I've been working off of for a few years now that makes use of local Swift Packages. In my workspace, I have a "Kit" project that generates a framework using several local Swift Packages as dependencies.

In Xcode 12, the local Swift packages resolve correctly and compiles, but each beta of Xcode 13 gives me the error: "[ProjectName].xcodeproj Missing package product '[LocalSwiftPackage]'"

Clearing the package cache, derived data, or restarting the application does not resolve the issue. Only Swift Packages that are remotely loaded from a URL are compiled correctly.

Using local packages to separate module code, while still being able to edit in the same project, has been essential to my workflow and would hate to see Xcode 13 release with these breaking changes, and I have not seen this issue listed in the known issues for the Xcode 13 release notes.

Has anyone else experienced this issue or found a workaround?

  • This started happening for me in Xcode 13 beta 5. I repeatedly delete derived data, reset the package cache, after many attempts it may finally work. Extremely frustrating.

  • In my case I got the local package open in another window. In the past it will give a more specific error saying the package is open, but now it doesn't.

Add a Comment

Accepted Reply

Check if Xcode 13 resides in Application folder. In my case it was in Downloads folder, moving it to Application folder solved the problem for me.

Replies

Check if Xcode 13 resides in Application folder. In my case it was in Downloads folder, moving it to Application folder solved the problem for me.

I eventually got this resolved. What seemed to get it working was re-adding my local packages using the "Add Packages…" menu option on the project that has the framework targets using the local package. This created a new "Packages" group in the project, and eventually started compiling correctly.

I also had been using the "Watchdog" app, which I have since disabled as I think it was causing issues when it would delete derived data.

  • Thank you @GravityBytes for posting this. I bumped into this issue today and your tip turned out to be the solution for me too.

    The only difference in my setup was that the packages were part of a workspace. I removed their reference and added them back and the build started to work again. The delete + re-add of the package references to the workspace file resulted in a clean diff.

    I'd say this is some quirk in the way Xcode caches stuff. Some folks on StackOverflow suggested to reset the packages cache. I did that but it was no help because the issue was with a local package not a remote one.

  • Thanks, solved my problem too!

  • Thanks, solved for me too

Add a Comment

I'm also seeing this in Xcode 13.0 final release.

The thing that worked for me was to disable the thread sanitizer.

  • This solved my issue. No clue why or how it's related. Don't forget to try this if your seeing something similar

  • Same here, disabling "Main Thread Checker" and "Thread Performance Checker" in Edit Scheme immediately resolved the issue. Go figure.

  • This trick helped me with Xcode version 14.3.1. Once I disabled the "Main Thread Checker", the errors regarding "missing package product" simply disappeared. Like magic. Thank you.

Add a Comment

In my case on Xcode 13.1, this issue get fixed after applying File -> Packages -> Reset Package Caches enjoy!

  • This worked for me too

  • Same here. Thanks!

  • Thanks! for my case, I need to reset cache and also update the packages.

Xcode 13.3, same issues, i removed all the embedded frameworks and re-added them, and it worked.

XCode 12.3 issue on Catalina appeared after deleting DerivedData Folder for project. Closing and re-opening XCode project, and cleaning build folder eventually worked.

I tried:

  • Clean project
  • Clean derived data
  • Resolve Package Versions (File > Package)
  • Update to Latest Package Versions (File > Package)
  • Restarted Xcode
  • Restarted Mac

And restarting the Mac is what worked 🥲

Post not yet marked as solved Up vote reply of luis Down vote reply of luis
  • Restarting My Mac actually works for me as well. You saved my day!

Add a Comment

I got the "Missing package product" error when including a local Swift Package in two xcode projects simultaneously (Xcode 13.4.1). My solution was to close one of the projects and then the error went away. It seems it is not possible to use the same local package simultaneously in two open projects.

  • I'm getting this specific variation of this issue and I have found a solution. Just trick xcode into thinking that one local library is two: • Close all projects from menu bar or ctrl-option-cmd-w • Delete contents of ~/Library/Developer/Xcode/DerivedData • Delete any Package.resolved, .swiftpm or .build files in ALL packages that are local. • Create a symbolic link to the local library "ln -s MyLibrary MyLibraryII " ...

  • ... • Don't touch Package/Project A, Package/Project B has to change package to the path of MyLIbraryII.

    You can now open one library in two seperate projects. Just keep in mind that it's jury-rigged.

Add a Comment

It still appears 2-3 times a week, a need to waste approx 0,5 hours to fix it every time. Please, fix this problem in Xcode, Apple developers :)

File -> Packages -> Update to latest version. works for me.

  • Thank you. Fixed my issue.

Add a Comment

EVERY DAY my Xcode welcomes me with missing packages problems. Yes, "Reset Package Caches" works but really Apple, fix this horrible issue, still present in Version 14.3 (14E222b)

Thank you. Removing and adding the local packages again also fixed my issue with XCode 14.3.1.

In my case, the error occurred because for one of my packages, they moved from using the master branch nomenclature to the main branch nomenclature, and in my project, it was set to the master branch. Changing this fixed all my outstanding issues. Xcode 14.2