Xcode 16 & Package load failure

I have installed Sequoia and Xcode 16 and now I can't add packages to my (or any project). I just get a message saying the package can't be resolved. Basically I can't carry on developing.

SORT THIS OUT APPLE

Same issue

Accepted Answer

Fixed the problem by completely removing Xcode 16 and reinstalling.

Delete ~/Library/Preferences/com.apple.dt.xcodebuild.plist should fix this. You don't need to uninstall Xcode completely.

didn't work

I was struggling with this error for a whole day, what helped me at the end:

1 - Deleting all spm cache and derived data: rm -rf ~/Library/Caches/org.swift.swiftpm ~/Library/Developer/Xcode/DerivedData ~/Library/org.swift.swiftpm ~/.swiftpm/xcode/

2 - Adding package with "Add Anyway" option

3 - Fully closing Xcode (cmd + q) and running this in project folder: xcodebuild -resolvePackageDependencies -disablePackageRepositoryCache

Hope it helps someone! :)

Wow, it's really painful, everything is not helpful for me. :( maybe I need to re-install Xcode.

xcode 16.1 has the same issue. What is apple doing?

Xcode 16 & 16.1 same issue. Reinstalling and cleaning cache didn't help.

That sounds weird, as git is working correctly.

Xcode 16.1, MacOS Sequoia 15.0.1

I had same issue with Same MacOS Sequoia 15.0.1, Package download with dependency not working after updating MacOS 15.1 it started working

FWIW, quitting Xcode and purging the folders mentioned by @SubvertDev allowed me to resolve the package dependency error.

Im on Xcode 16 on macOS 14.5, and had the error in a fairly large Xcode Project with lots of dependencies.

you can run this each time you need to install a package

plutil -remove IDESwiftPackageAdditionAssistantRecentlyUsedPackages ~/Library/Preferences/com.apple.dt.Xcode.plist

I've also encountered some weird issues with resolving packages all of a sudden. Turned out I had this section in my ~/.gitconfig file

[safe]
	bareRepository = explicit

Changing explicit toall fixed the issue for me. This is a potential security risk but that line was not there before and the default value is all.

This section was not present 10 days ago. In the meantime, I've upgraded macOS from 15.0 to 15.1 but I've also upgraded quite a few brew formulae. I'm doubting any of this would change the .gitconfig file but have no explanation so far.

Anyway, if you're having issues with package resolution, check if you've got that git configuration set.

Check if if you don't need to agree to the updated license agreement on developer.apple.com - fix me the problem with both Xcode 16 and 16.1.

Fixed the issue by opening Keychain Access, searching & removing all github entries (or updating them). For some reason xcode 16.x preferes keychain passords over its own settings.

I faced the same problem in Xcode 16.1. These two solutions worked for me, but I must repeat them every time I add a new Swift package (SPM).

The first way:

  1. When you are on the loading SPM screen, press Command command + delete/backspace to clear the SPM history.
  2. Clear the history. [enter image description here][1]
  3. After that, I can add a new SPM.

The second way:

  1. Close Xcode completely. Ensure it’s not running in the background.
  2. Open the Terminal and run the following command to remove cached Swift Package references: plutil -remove IDESwiftPackageAdditionAssistantRecentlyUsedPackages ~/Library/Preferences/com.apple.dt.Xcode.plist
  3. Reopen Xcode and your project. You should now be able to add a new Swift Package without any issues.
Xcode 16 & Package load failure
 
 
Q