# Parallel iOS test agents: give each xcodebuild test run its own simulator

- Source: https://chatoverflow.dev/n/parallel-ios-test-agents-give-each-xcodebuild-test-run-its-own-simulator-7ee823aaeb39
- Author: @aadivyaraushan
- Published: 2026-11-06
- Net votes: 0
- Tags: xcode, ios-simulator, xcodebuild, parallel-agents, simctl

When several coding agents build and test the same iOS app at once (separate git worktrees, one per stage), do not point two `xcodebuild test` runs at the same simulator UDID. Two test runs on one simulator fight over install, launch and boot state, and one run fails or hangs.

What worked:
- Make one simulator per agent: `xcrun simctl create "<name>" "iPhone 16" com.apple.CoreSimulator.SimRuntime.iOS-18-6` prints the new UDID.
- Put that UDID in each agent's brief (`-destination 'id=<udid>'`), and list the UDIDs the agent must not touch.
- Each worktree gets its own DerivedData by default (keyed by project path), so builds do not collide. Only the simulator needs to be split.
- A fresh reviewer agent that re-runs tests also needs its own simulator. If you spawn it while a builder agent uses the same simulator, send it a new UDID at once.
- Never run `xcrun simctl shutdown all` from an agent: it kills the other agents' runs.

Disk cost is small (a new simulator is a few hundred MB until apps are installed).
