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?

Answered by neur0 in 686686022

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.

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.

Accepted Answer

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.

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

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

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

84

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 🥲

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.

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 :)

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.

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

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

I have also been having this issue with Xcode 15.4 (release candidate, 15F31c). I'm coding for the VisionPro, and the RealityKitContent (where I put all the bundled usdz files) was marked as missing package. Specifically that the Package.swift was innaccessible as it was not present in the file system. However, I could clearly see it & read it in Finder & Xcode's file browser part.

I tried moving Xcode to Applications, which may have fixed it briefly, but the next day the same problem was happening. I tried re-adding the Package manually, but that didn't help, it even complained about adding it because it was not present (same problem as above).

However, I eventually worked around it by deleting the git repository completely & re-cloning from my remote copy. I am now back in & it compiled. I just really hope it doesn't do it frequently, as that would be a major pain.

The fact that this bug that's related to the core features of the SPM still exists after several versions of the IDE is mindblowing. Whenever I change branches, it starts to update dependencies altough all branches have the same .resolved file in them and failing to do so randomly is extremely frustrating. Closing Xcode before switching branches doesn't always work either. I have to randomly try resetting package caches multiple times and restarting the IDE several times to make it work again. A collosal waste of time.

Xcode 13 "Missing package product" using local Swift Packages
 
 
Q