Unable to connect to the iOS simulator

The device is up but the run cannot connect to it — the test runner never attaches, or you see "Unable to connect to" / lost-connection errors.

Partial fit Likely class: test-runner / CoreSimulator connection failure · Updated

Symptom

The device appears up, but the run cannot establish a connection to it. The XCTest runner never attaches, or you get a connection / lost-connection error partway through bringing up the tests.

What it usually looks like

Why it happens / likely failure classes

Something between xcodebuild/the test host and the simulator’s services did not connect:

XCSteward treats connection failures before XCTest attaches as runner_bootstrap_failure: runner or environment setup failed before XCTest attached. That keeps testmanagerd or launch-session failures separate from actual test assertions and app-code regressions.

Quick checks

# Wait for the device to be genuinely ready before expecting a connection
xcrun simctl bootstatus <UDID> -b

# Can the device launch a stock app at all right now?
xcrun simctl launch <UDID> com.apple.mobilesafari

# Is the subsystem healthy / is anything else touching this device?
pgrep -lf 'CoreSimulator|xcodebuild|simctl|launchd_sim'

If launching a stock app also fails, the device is not truly ready (or the subsystem is wedged) — that is the real issue, not your test target.

Manual mitigations

When XCSteward may help

The gap between “booted” and “actually connectable” is part of what XCSteward’s readiness model targets:

Worth testing against this class of failure when the connection problem tracks with device readiness or contention rather than your test code.

When XCSteward probably will not help

Common questions

What does "Unable to connect to the iOS simulator" usually mean?
It usually points to test-runner / CoreSimulator connection failure. The device is up but the run cannot connect to it — the test runner never attaches, or you see "Unable to connect to" / lost-connection errors. Start by checking simulator readiness, destination selection, CoreSimulator/simctl responsiveness, and whether another xcodebuild, simctl, or Simulator process is already active before treating it as a test-code failure.
Can XCSteward help with "Unable to connect to the iOS simulator"?
This is a partial fit. XCSteward may help when the failure comes from execution readiness, destination selection, timeouts, cleanup, or contention. It probably will not help when the root cause is missing configuration, a broken runtime, a test-code bug, or a vendor image defect.
What should I check first?
Check whether xcrun simctl commands return promptly, whether xcodebuild can resolve a concrete simulator destination, whether the device is truly ready rather than merely Booted, and whether concurrent agents, scripts, or manual runs are touching the same simulator subsystem.