What can be done about XCode always spinning its wheels and stuck on installing/attaching to app?

I have a real problem with XCode (15 and 16) which is that all the time it'll get stuck installing/attaching to an app.

It'll be working fine one minute, I can make a code change, build, and run the app (on hardware) and everything will be fine. But then make another change, build and run again and now XCode will get stuck saying "Installing app to phone" / "Attaching to app on phone".

If I click stop and try and run again now there'll be two "Installing app to phone" instances running, do it again and then there'll be three and so on.

If I quit XCode and relaunch it then it does not fix the issue, I have to terminate XCode and reboot the phone. And then it'll be ok again, but only for about 10 minutes, but then it'll start doing the exact same thing again. Its impossible to work like this, having to reboot the phone every 10 minutes or so. Is there any solution or tricks? (is it possible to kill the hung task within XCode for example?)

Answered by jlilest in 797370022

Something that has worked for me is to right click on the device in the devices and simulators screen and select unpair device. It should immediately start pairing and the phone prompt you to trust the computer. It might be worth unplugging and plugging it back into your mac first, if this doesn't work.

Accepted Answer

Something that has worked for me is to right click on the device in the devices and simulators screen and select unpair device. It should immediately start pairing and the phone prompt you to trust the computer. It might be worth unplugging and plugging it back into your mac first, if this doesn't work.

While I'm glad you have a workaround in unpairing and repairing your phone, that is not what I'd consider a solution. I don't want developers to be in a situation where they need to reboot, replug, repair, etc to get development done.

Could you install the CoreDevice logging profile (https://developer.apple.com/bug-reporting/profiles-and-logs/?name=CoreDevice), reproduce the issue, then collect a diagnostic tarball for us by running xcrun devicectl diagnose? Then file a feedback report with that diagnostic tarball at http://feedbackassistant.apple.com? If you report the FBA# here and/or include the link to this forum post in the report, that will help out as well. Thanks.

What can be done about XCode always spinning its wheels and stuck on installing/attaching to app?
 
 
Q