Xcode beach-balling regularly, don't know what to do.

Hi all,

I'm running the latest version of Xcode (12C33) on the latest version of macOS Big Sur 11.1 (20C69) on my new Apple Silicon MacBook Air (16GB, 1TB storage), and while it worked great about a week ago last time I was working on any of my apps, now it beach-balls every couple of minutes for several minutes at a time.

There's no apparent error, and it happens with new projects and old projects, regular UIKit apps and SwiftUI apps, ones for just the iPhone and ones that are cross-platform. I've uninstalled everything I could think of that might cause problems, including Chrome and demos of music software (Ableton lite et al) that came with my audio interface, even though Xcode has worked fine since I installed any of those items. I've even uninstalled and re-installed Xcode, but it still happens constantly. I literally can not get anything done and I'm not sure where to look.

The only things I have installed since the last time Xcode worked right which I haven't installed are a couple of Apple Arcade games, but I might do those as well.

It happens when there are no other apps running, but when it's happening if I run Terminal the load is low, and if I use Activity monitor, there's literally nothing going crazy on any of the eight cores. Not a lot of reads/writes, nor a lot of data moving up and down the pipe.

It just seizes up, and then eventually does whatever I asked it to, but a 2-10 minute pause every time I edit half a line of code, or longer if I build the app and deploy it to my phone or a simulator just doesn't work for me.

Any ideas?

The last time Xcode ran well for me, realize as I write this, was when I tried out a basic hello-world watch app. It displayed great in the swiftui console, but I couldn't get it to deploy to my watch, so eventually gave up. Is it possible this left some cruft in the system that I need to clean out?

HELP!! (please)

Answered by RandyHill in 655823022
Reinstalling Big Sure appears to have fixed the problem.
Just for the fun of it, I removed the watch simulator from the available simulators, then I deleted the com.apple.xcodebuild.plist and the com.apple.dt.Xcode.plist, as well as the com.apple.dt.Xcode directory within my ~Libary/Caches directory.

It's still just as bad. Even opening a project it just locks right up.
OK, one more piece of information: I created a new test account on my MBA and fired up Xcode for the first time and created a new project, just a simple SwiftUI project, a Hello World that would have caused beach-balling in my main account.

It worked fine.

So there's gotta be some cruft in my setup that's causing this problem. I'll check to see if I have any other programs installed that I might have forgotten about, and I'll uninstall the Apple Arcade games, but... any other ideas?
OK, so I removed two Apple Arcade games, the older non-pro Pixelmator, Discord, and Signal.

And now Xcode isn't beach-balling anymore.

I *think* I had Signal in place already when Xcode was working before. Discord, now that I think about it, is almost certainly a more recent addition. I totally doubt that Pixelmator is an issue--and I'm almost certain it was already in place--but I did buy Pixelmator Pro, so I don't really need Pixelmator anymore. I didn't delete Pix'Pro, and everything's fine.

So I'm thinking about trying to re-add them one at a time to see if Xcode breaks again, but the good news is that after a bunch of random thrashing, something seems to have worked.
I've re-added Signal and Discord, and no problems so far...
I had this happen twice two weeks ago, and was able to get the problem to go away by

deleting xcuserdata: folder from both of your .xcodeproj & .xcworkspace 

defaults delete com.apple.dt.Xcode

rm -r ~/Library/Developer/XCode/DerivedData

rm -r /Applications/Xcode.app

rm -r ~/Library/Caches/com.apple.dt.Xcode

rm -r  ~/Library/Developer

rm -r ~/Library/MobileDevice

rm ~/Library/Preferences/com.apple.dt.Xcode.plist

restart mac

But unfortunately it's happening again, and these process isn't fixing it. In my case it appears to happen with any project.
You can also try

xcrun simctl shutdown all && xcrun simctl erase all

to entirely reset simulator. That helped me the first two times.

Edit: And so far looks to have fixed the third time too.
None of my fixes are working, forced to just restart Xcode every 1-5 minutes when beachball appears.

In my case it's possible I have an IBDesignable issue, it's a large project with some IBDesignable errors in storyboards (that I didn't make). I'm curious why it always takes a few minutes to beach ball, seems like a background process that might be doing something to storyboards and takes that long to start.
So the error I am getting from IBDesignables is:

dlopen(app name.app, 1): no suitable image found. Did find:
AppName.app: macho-0, but wrong architecture

I had excluded ARM64 in order to get Xcode to build to Simulator when I first got my M1 MacBook Air. So I removed the exclusions and built again and Xcode suddenly seems more stable, running for longer without the spinner. This is even though IBDesignable error still exists (after clean/deleting derived data) and I still get the spinner if I click on the error message in Storyboards.
Accepted Answer
Reinstalling Big Sure appears to have fixed the problem.
Xcode beach-balling regularly, don't know what to do.
 
 
Q