Xcode 12.5 stays in a loop "Resolving Swift Packages" until it slows down to a crawl

Today, after Xcode 12.5 upgraded, when I try to work on my projects, Xcode keeps running "Resolve Swift Packages" every second or so, this means that it both keeps flashing the display the whole time - it never settles, and it also keeps the machine busy and eventually, Xcode becomes unusable.

This has a movie showing what my Xcode looks like tonight, the pauses in the video are caused by Xcode not responding to scrolling, since I left that thing idling while I had dinner:

tirania.org/tmp/xcode-hang.mov

This can be reproduced by downloading github.com/migueldeicaza/SwiftTerm and opening either the Swift solution or the Xcode projects.

I have submitted a bug report.
  • Slightly different issue, but my Xcode simply spins on "Resolving package graph" and won't do anything else. If I try to close it, I get the rainbow ball of death.

    The fix was to delete the DerivedData dir of the project it was trying to resolve.

  • For me, the issue came back ... deleting DerivedData did not fix it. However, I noticed that waiting a while (eg., 1 hr) the problem resolved itself. That suggests that Xcode may be doing some caching that causes the problem and once the cache is stale the problem resolves.

Add a Comment

Accepted Reply

I had the same issue since updating to Xcode 12.5. However, what I discovered is opened Swift packages loop on resolving if you use a relative location for DerivedData. Try opening Xcode 12.5 preferences go to Locations and set DerivedData to default location. Problem went away for me. This is a less destructive way to solve this problem rather than deleting Xcode configuration.

Replies

In case this helps someone diagnosing, or running into the same issue.

I could not figure out what is triggering this, but wiping the Xcode configuration fixed this for me.

Backup your configuration like this:

defaults read com.apple.dt.Xcode > backup.defaults

Then remove all the settings:

defaults delete com.apple.dt.Xcode


  • Thank you! This is exactly what helped me!

Add a Comment
I had the same issue since updating to Xcode 12.5. However, what I discovered is opened Swift packages loop on resolving if you use a relative location for DerivedData. Try opening Xcode 12.5 preferences go to Locations and set DerivedData to default location. Problem went away for me. This is a less destructive way to solve this problem rather than deleting Xcode configuration.
Hello,

Thanks Bmalbuck - I discovered this just today, and came back to update folks on that, and saw your response.

It does seem like the bug is bound to the relative ~/DerivedData.
Note that softlinks do not impose any problems. I have my DerivedData softlinked to a ramdisk volume and everything is pretty snappy that way.

I'm having the same issue on Xcode 13.2 on Monterey. Changing the DerivedLocation to the default path resolves the issue but it's not ideal. Do we know when the issue will be fixed in Xcode? Thanks

Here I had the same libs assigned in different targets/schemes which was not necessary. After removing the redundant ones, the loop disappeared.

I had this also with the 'Default' setting of Derived Data. Solution was to do a pod install, since the installed pods have been changed by another team member.