I'm on XCode 15.2, and it's also hanging while attaching the debugger.
It seems to happen sometimes (not all the time) when I switch between a wireless connection and a wired connection between XCode and my device. Probably when I lose my patience and plug in the cable while XCode is building/installing to the device.
The above steps alone did not work for me. I found that I also needed to shut down and restart my iPhone. So, here's what I do when this happens:
Close Xcode
Delete ˜/Library/Developer/Xcode/Derived Data
Delete ˜/Library/Developer/Xcode/iOS Device Support (note that I'm not deleting entire Xcode directory as that also deletes your archives)
Shut down Mac
Shut down iPhone
Restart iPhone
Restart Mac
Some of these steps are probably unnecessary, but as this doesn't happen too frequently for me, I just follow this to be on the "safe" side.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: