Fix For Xcode Getting Stuck When Attaching To An App

Periodically Xcode will get hung up while attempting to attach to an application in the iOS Simulator. I’ve tried a number of things to get around this in the past with varying levels of success. Let me share what has worked consistently to resolve this problem.

The image below shows how the message looks when Xcode and the simulator are stuck:

Here are the steps I follow when this happens:

  • Start the simulator if it isn’t already running
  • Choose the option “Reset Content and Settings…” from the iOS Simulator menu
  • Clean and rebuild the project

If you have another approach, please post a comment.

  1. unfortunately I ran into this problem a few days ago and I do not know if your guide would help me but it seems right to tell you my problem and how I solved, as it shows your guide also my xcode froze at “attaching-to … “, what I did was force in the host file on my localhost by simply adding the line 127.0.0.1 localhost and everything went back to normal functioning

  2. just tap on the simulator icon in the dock and it will open fine.

  3. Any reason, why it occurs.. me also get it reproduce frequently..??

  4. Sometimes simply cmd-tab to the simulator will unstick it. Other times, I have to totally nuke Xcode with this:

    #!/bin/sh

    ps ax | grep -i Xcode | awk ‘{print $1}’ | xargs kill -9

  5. Resetting the simulator is a fairly drastic move, especially if you’ve loaded a lot of test data.

    While my freezes don’t occur at the “attaching to” stage, my xcode tends to freeze while displaying “running app in simulator” (which is not true), about every 10-15 app launches, although the frequency is highly variable and doesn’t seem to correlate with anything I can observe.

    My solution is to force-quit xcode, quit the simulator, then restart xcode and let it launch the simulator again.

  6. Clicking on the simulator icon on the dock will “unstick” it. Works 100% for me.

  7. Little typo there.
    It’s simulator instead of simlator.

Comments are closed.