> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobster.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS simulators and the mobster sim commands

> The headless simulators Mobster creates for your checks, what they cost your Mac, and the mobster sim commands that manage them.

`mobster verify`, `mobster test` and `mobster mcp` run your app on iOS simulators that Mobster creates and manages. `mobster sim doctor --fix` sets the first one up, and Mobster handles the rest.

The simulators Mobster manages are headless. It boots them with `xcrun simctl` and never opens Simulator.app or any other window. It boots, resets, shuts down or deletes only the simulators it created, and leaves yours alone.

## Set up a simulator

```sh theme={"theme":"css-variables"}
mobster sim doctor --fix
```

`mobster sim doctor` checks, in order: Apple silicon, Xcode selected (the full app, not the Command Line Tools alone), Xcode's first launch, an iOS runtime, the device type, `git`, 5 GB free for the data folder, the WebDriverAgent build, the simulators Mobster manages and their WebDriverAgent, free ports, and the model key, `ANTHROPIC_API_KEY` or `OPENAI_API_KEY`, as set or not set (never shown). It prints the fix for each problem. `--fix` also prepares the simulator. It never runs `sudo` and never downloads a runtime. When the runtime is missing, it prints the command that does:

```sh theme={"theme":"css-variables"}
xcodebuild -downloadPlatform iOS
```

## Choose the device and runtime

A simulator is named `Mobster · <device type> · <runtime>`, such as `Mobster · iPhone 17 Pro · iOS 26.4`. A second one for the same pair gets ` · 2`.

The device type is `iPhone 17 Pro` when your Xcode has it, else the first of `iPhone 16 Pro` and `iPhone 15 Pro`, else the newest iPhone. The runtime is the newest iOS runtime installed. `--device` and `--runtime` on `verify`, `mcp` and `sim prepare` choose others.

Mobster runs up to 4 simulators for one device and runtime at a time, so four runs or agents can go at once. `MOBSTER_MAX_SIMS` sets that limit, and the Mac's free memory can lower it ([Memory](#memory)). A run that finds them all busy waits for one, then ends `couldnt_run` with class `busy`.

After the first boot, Mobster sets the status bar to 9:41 with full signal and battery, and turns off autocorrection, predictive text, smart quotes and smart dashes, so typed text arrives exactly as written. It also turns off keyboard clicks and the lock sound, so a test run makes no sound on your Mac. Set `MOBSTER_SIM_SOUNDS=1` to keep them on.

## Keep the Mac's memory free

Plan on about 2 GB of memory for each booted simulator with its WebDriverAgent and a `mobster mcp` session. Simulators stay booted between runs so the next run starts warm. `mobster sim shutdown` frees the memory.

A simulator boots only when the Mac has 4 GB free (free, inactive and speculative pages, from `vm_stat`). The first simulator always boots. When less is free and one is already running, the run is refused at once, with the names of whoever holds the running ones, instead of pushing the Mac into swap.

Before it creates or boots a simulator, or builds WebDriverAgent, Mobster reads the 1-minute load average. At one runnable task per core or more, it waits up to 30 seconds for the Mac to settle, says so in the run's progress, then refuses with class `busy`. `MOBSTER_MAX_LOAD` sets the load at which the Mac counts as busy. On a runner your CI host owns, such as GitHub's hosted Mac, the job has the Mac to itself, so Mobster doesn't wait unless you set `MOBSTER_MAX_LOAD`. A booted, free simulator needs no wait.

`mobster sim list` shows who holds each simulator: the client, its process and for how long. `mobster sim release --all-mine` asks the agents started from your shell's app to let go of theirs. Each lets go within 15 seconds. A simulator held from another app is left alone.

## Choose a reset level

Before a run, Mobster resets the app under test. Apple's own apps (`com.apple.*`) are never reset.

| Level | Does | Default when |
| - | - | - |
| `none` | Nothing: the app keeps its data | never by default |
| `data` | Quits the app, deletes its preferences, empties its `Documents`, `Library` and `tmp` folders and its app group folders, and resets its privacy permissions and the simulator's keychain | the app is named by bundle ID only |
| `reinstall` | Uninstalls the app, installs your `.app` again, and resets privacy permissions and the keychain | a `.app` is given |

Every folder Mobster empties must resolve inside that simulator's own folder, `~/Library/Developer/CoreSimulator/Devices/<udid>`, or the reset stops.

## Test Face ID and Touch ID

Use a booted simulator from `mobster sim list`:

```sh theme={"theme":"css-variables"}
mobster sim biometric <UDID> status
mobster sim biometric <UDID> enroll --type face-id
mobster sim biometric <UDID> nonmatch --type face-id
mobster sim biometric <UDID> match --type face-id
mobster sim biometric <UDID> unenroll --type face-id
```

```text theme={"theme":"css-variables"}
Biometric enrollment: enabled
Sent face-id match event. Check the app for the result.
```

Open your app's Face ID prompt before you send `match` or `nonmatch`. Both need enrollment. `status` reads enrollment, and `enroll` and `unenroll` confirm the new state. A match command only sends the event, so look at your app for its response. `--type` picks `face-id` or `touch-id`, and enrollment is shared between them. `--json` prints `udid`, `action`, `type`, `enrolled` and `event_sent`.

In a check, `conditions.biometric` sets enrollment and `dialogs.biometric` answers the prompt ([System dialogs](https://docs.mobster.dev/testing.md#system-dialogs)). These commands refuse a simulator another Mobster run is using, and change only simulators Mobster created. On a real iPhone, Face ID still needs you to look at the phone.

## Open a deep link

Mobster opens a check's deep link, such as `yourapp://today`, through WebDriverAgent, which hands it straight to the app. When it has to fall back to `xcrun simctl openurl`, it presses Open on iOS's "Open in …?" prompt. Your app must declare the URL scheme in its `Info.plist`. [Deep links](https://docs.mobster.dev/deep-links.md) lists your project's links and checks where each one lands.

## Manage simulators with `mobster sim`

| Command | Does |
| - | - |
| `mobster sim list [--json]` | Lists the simulators Mobster manages, with their state, WebDriverAgent address and who holds each |
| `mobster sim release --all-mine` | Asks the agents started from your shell's app to let go of their simulators |
| `mobster sim prepare [--device NAME] [--runtime NAME] [--json]` | Creates the simulator if needed, boots it, builds and starts WebDriverAgent, and prints how long each phase took |
| `mobster sim doctor [--fix] [--json]` | Checks what `verify` needs and prints the fix for each problem. `--fix` also prepares the simulator |
| `mobster sim biometric UDID (status \| enroll \| unenroll \| match \| nonmatch) [--type face-id \| touch-id] [--json]` | Reads or changes biometric enrollment, or sends a Face ID or Touch ID event to an idle, booted Mobster simulator |
| `mobster sim shutdown [UDID]` | Stops WebDriverAgent and shuts down every Mobster simulator that isn't in use, or one |
| `mobster sim erase UDID` | Erases one Mobster simulator: its apps and data go |
| `mobster sim delete (UDID \| --all)` | Deletes Mobster simulators. Only UDIDs in the registry whose names start with `Mobster · ` |
| `mobster sim prune [--json]` | Deletes simulators unused for 14 days, stale WebDriverAgent builds, and registry entries for simulators that are gone |

Exit codes: `0` ok, `1` a check or an action failed, `2` a usage error. The [CLI reference](https://docs.mobster.dev/reference/cli/sim.md) lists every flag.

## WebDriverAgent

Mobster drives and reads the app through WebDriverAgent, the open-source XCTest server Appium maintains. The first run on a new Xcode:

1. clones the pinned release and checks its commit.
2. applies the Mobster patches. The screen stream listens on 127.0.0.1, like the server, and both refuse requests from browsers and from other hosts. The capture gate keeps screenshots and screen reads from running at once, so an app keeps answering screen reads after a swipe while the stream runs. Set `MOBSTER_CAPTURE_GATE=off` to start simulator runners without it.
3. builds it once for the iOS Simulator with `xcodebuild build-for-testing … CODE_SIGNING_ALLOWED=NO`. No Apple ID or team is needed.

The build is cached per Xcode build version, so later runs start the runner in seconds. `mobster sim prune` removes builds for Xcode versions you no longer have.

### Ports

Each simulator gets its own WebDriverAgent port, and a screen-stream port 1000 above it.

| Setting | Value |
| - | - |
| WebDriverAgent port | `MOBSTER_SIM_PORT_BASE` (8310 unless you set it) plus the simulator's slot, 0 to 39 |
| Screen stream (MJPEG) port | The WebDriverAgent port plus 1000 |
| Never used | 8100, 8200–8299, 8765, 9100 and 9200–9299 |

A port in use moves the simulator to the next free slot. WebDriverAgent listens on 127.0.0.1 only. After starting it, Mobster checks both ports with `lsof`, and stops the runner if either one listens beyond this Mac.

## Where Mobster keeps simulator files

Mobster keeps its simulator state in its data folder: `$MOBSTER_DATA_DIR` when it's set, else `~/Library/Application Support/app.mobster.desktop/dev`.

| Path | Holds |
| - | - |
| `simulators.json` | The registry: every simulator Mobster created, the only ones it may delete |
| `simulators.lock` | The lock around registry changes |
| `wda/src-<commit>/` | The pinned WebDriverAgent source (appium/WebDriverAgent v16.12.10) |
| `wda/build-<xcode build>-<commit>-<patches>/` | The WebDriverAgent build for your Xcode |
| `logs/wda-build.log` | The WebDriverAgent build's output |
| `logs/wda-<udid>.log` | Each WebDriverAgent runner's output |
| `logs/sim.log` | What the simulator manager did |

The simulators themselves live in Xcode's default device set, like yours, because `xcodebuild` can't see a private set. They show up in `xcrun simctl list devices`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.