> ## 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.

# Drive an iPhone over Wi-Fi

> Reach an iPhone over Wi-Fi after one cable pairing, through the encrypted link between this Mac and the phone. It has an off switch.

After you set up an iPhone with a cable once, Mobster reaches it over Wi-Fi when it's unplugged. Tasks, the live view, manual control, approvals and `--device` work the same as on the cable.

Wi-Fi for iPhones is off until you turn it on. While it's off, every task uses the cable.

## Turn on Wi-Fi for an iPhone

1. Set `MOBSTER_WIFI_TRANSPORT=1` in your env file, then quit and reopen Mobster. The env file of Mobster for Mac is `~/Library/Application Support/app.mobster.desktop/agent.env`. `POST /api/wireless` with `{"wifiTransport": true}` does the same while it runs, and `MOBSTER_WIFI_TRANSPORT=0` turns it off again.
2. Plug the iPhone in, unlock it, and turn on Wi-Fi for it:

   ```sh theme={"theme":"css-variables"}
   mobster wifi on --device "Work iPhone"
   ```

   This sets the same switch as Xcode's **Connect via network**, over the cable, once. When Mobster can't set it, it tells you to tick **Connect via network** for the phone in Xcode › Window › Devices and Simulators.
3. Unplug it, keep it unlocked and on the same Wi-Fi as this Mac, and check the link:

   ```sh theme={"theme":"css-variables"}
   mobster wifi probe --device "Work iPhone"
   ```

In Mobster for Mac, the same switch is **Use over Wi-Fi**: on Add a device once the device is ready ("Use Work iPhone over Wi-Fi", **Turn on**), and in each device's **Rules…** on the Devices page. Add a device's **Over Wi-Fi** tile (next release) runs the probe with **Check Wi-Fi** on an unplugged phone, which takes up to 3 minutes, and shows **Works here** with the **Use devices over Wi-Fi** switch once it passes.

### Turn it off

`mobster wifi off` stops using the phone over Wi-Fi at once. When Mobster turned the phone's switch on, it turns it off on the phone too, over the cable:

```sh theme={"theme":"css-variables"}
mobster wifi off --device "Work iPhone"
```

```text theme={"theme":"css-variables"}
Wi-Fi is off for Work iPhone. Mobster uses it only with the cable.
```

When the phone isn't plugged in, doesn't trust this Mac or doesn't let Mobster turn its switch off, the phone still accepts Wi-Fi connections from Macs it trusts. `mobster wifi off` then says so and exits 1:

```text theme={"theme":"css-variables"}
Wi-Fi is off for Work iPhone. Mobster uses it only with the cable.
Work iPhone still accepts Wi-Fi connections from Macs it trusts: Mobster turns its Connect via network switch off only over the cable.
Plug Work iPhone in and unlock it, then turn off Wi-Fi for it again.
Plugged in and unlocked: mobster wifi off --device "Work iPhone"
```

Mobster notes the switch before it turns it on, and keeps the note until the switch is off again. So a `mobster wifi on` or `mobster setup` that stopped midway still shows, and `mobster wifi off` with the phone plugged in turns it off. When you ticked **Connect via network** in Xcode yourself, Mobster leaves that switch alone, tells you to untick it there, and exits 0. With `--json`, the first case is `{"ok": false, "code": "still_on", ...}` (or `off_failed`), and the Xcode case is `{"ok": true, "next": {"code": "xcode_on", ...}}`.

## Set up a new iPhone over Wi-Fi

With Wi-Fi for iPhones on, setting up a new iPhone (the first run, **Add a device**, or `mobster setup`) can end wireless, after one cable moment. Mobster asks you first, for each phone:

* **In Mobster for Mac:** **Use Work iPhone over Wi-Fi** with **Turn on**, on Add a device once the device is ready, and in its card's **Rules…**.
* **In a terminal:** once the phone trusts this Mac, `mobster setup` asks `Use Work iPhone over Wi-Fi when it's unplugged? Mobster turns on its Connect via network switch over this cable, the same switch as in Xcode.` Enter means no. After a yes, it waits for the switch to be set before it ends.
* **With no terminal** (`mobster setup --json`, or output to a pipe): Mobster leaves Wi-Fi off, prints `{"waiting": "wifi", "hint": ...}` and exits 1. The hint names the yes to give: `mobster setup` on a terminal, or `mobster wifi on --device "Work iPhone"` with the phone plugged in.

Say yes, and the checklist's last row is **Wi-Fi**:

1. You plug the phone in, tap **Trust** and say yes. While it's on the cable, Mobster turns on its Wi-Fi switch once.
2. You turn on Developer Mode. The phone restarts and drops off the cable for a minute, and Mobster waits up to 5 minutes for it to come back.
3. The helper app installs over the cable.
4. Once the helper runs, Mobster waits up to 90 seconds for the encrypted link to the phone. Then the **Wi-Fi** row says **Unplug** the phone. If the link doesn't come up, the phone stays on the cable and the row says why. Close Add a device with **Keep working**, and Mobster still finishes the step and sends a notification to unplug the phone.

If you say no, the phone says no, or Mobster can't read its answer, the phone stays on the cable. Turn Wi-Fi on later with `mobster wifi on` or **Use over Wi-Fi**. A phone you set up before has no Wi-Fi step.

| iOS on the phone | What setup does |
| - | - |
| before 17.4 | waits for the link, then keeps the phone on the cable and says the link often doesn't come up before iOS 17.4 |
| 17.4 to 26 | waits for the link, then says to unplug the phone |
| 27 and later | the same, and names Device Hub's **Pair Nearby Device** |

`GET /api/setup` and `GET /api/devices/{device}/setup` carry the step as `wifi`: `{state, reason, os, hub, cable}`. Its `state` is `asking` while Mobster waits for your yes.

## Switch between the cable and Wi-Fi

| The phone is | Mobster uses |
| - | - |
| plugged in | the cable |
| unplugged, Wi-Fi on for it, and the encrypted link up | Wi-Fi |
| unplugged otherwise | nothing. It shows as not plugged in, with what to do |

A switch waits until no task is running on the phone. Plug the cable in during a task over Wi-Fi, and the task finishes over Wi-Fi before Mobster moves to the cable. Unplug the cable during a task on the cable, and the task stops.

If the link drops during a task you started in Mobster for Mac or the terminal UI, Mobster says "Your iPhone went out of reach over Wi-Fi: bring it back or plug it in and Mobster carries on" and waits 2 minutes. When the phone answers again, over Wi-Fi or the cable, the task goes on. A schedule, `mobster run` or a coding agent over MCP stops at once with "Your iPhone went out of reach over Wi-Fi, so Mobster stopped." Either way, Mobster looks at the screen before it sends a step that may or may not have happened, and never sends it again blind.

Mobster checks the link every 10 seconds. When it drops, Mobster tries again after 1, 2, 4 and 8 seconds, up to 60, and at once when this Mac joins another network. With two phones, each has its own link and its own ports. In Mobster for Mac, the iPhone's pane shows a Wi-Fi glyph while it's on Wi-Fi, and **Try again** looks for an unreachable phone at once.

### When the phone needs you

Over Wi-Fi, iOS asks you to unlock the phone, then for Face ID or its passcode, before it lets the helper app start. When nobody answers, the start fails with "Authentication canceled". Mobster never unlocks a phone or enters its passcode, so it waits for you:

* While the phone is locked, the start waits. Unlock the phone, and the start goes on within a few seconds.
* While iOS asks for Face ID or the passcode, the helper tries again until you answer.
* The phone reads **Needs you** on the Devices page and in the device switcher, and its pane says **iPhone needs you** with the steps: "Unlock it. Use Face ID or its passcode when asked. Or connect it to your Mac with a cable."
* Plug the phone in instead, and Mobster uses the cable.

`GET /api/wireless` gives the problem code `needs_you`, and in `GET /api/devices` the phone's `wifi.needsYou` is `true`.

## What works over Wi-Fi

| You do this | Over Wi-Fi |
| - | - |
| Read the screen, tap, type, launch an app, run a task | through the same helper and ports as the cable |
| Check whether the phone is locked | `mobster devices lock-probe` asks the helper app, else Xcode's device service (`devicectl device info lockState`). A lock state it can't read is never taken as unlocked |
| List the apps on the phone | through `devicectl device info apps` |
| Install a build (`install_app`, `mobster phone install`) | through `devicectl device install app`, with a signed build and the phone unlocked. If the link drops mid-install, the install stops and isn't tried again |
| Read the battery | from the helper app |
| Move photos and videos | through the helper app ([Files](https://docs.mobster.dev/files.md#photos-and-videos)) |

An app's files, audio and logs need the cable.

## Check the link

`mobster wifi status` lists each iPhone set up here: on the cable, on Wi-Fi, or not reachable over Wi-Fi, and whether Wi-Fi is on for it. It reads only.

`mobster wifi probe` checks one unplugged phone step by step and prints what it saw:

1. Whether this network lets devices see each other.
2. What Xcode's device service reports for the phone, with every connection field.
3. Whether the encrypted link is up, its address is in `fd00::/8`, and this Mac reaches it through the link (a `utun` interface that holds this Mac's end and isn't a VPN). When it doesn't, the step says why, for example `utun4 holds no address on a link to fd7a:1c2b:3d4e::1 (fd12:3456:789a::2/64), so it isn't the tunnel to the phone`.
4. What `devicectl device info lockState` and `device info apps` return. This step doesn't change the result.
5. Whether the helper app answers through a relay on `127.0.0.1`. With `--start`, the probe launches the helper over Wi-Fi first and stops it at the end. Quit Mobster for Mac before you use `--start`.
6. That `8100` and `9100` don't answer on the phone's Wi-Fi addresses or on this Mac's default gateway. On the phone's Personal Hotspot, the phone is the gateway, so an answer from the helper there passes.
7. Whether usbmux lists the phone over the network, for the record only.

It exits 0 when every check passed and 1 when one failed. `--json` prints one object with each step and its fields.

### Networks that keep devices apart

Guest, hotel and campus Wi-Fi often stop devices from reaching each other and block Bonjour, the way Macs and iPhones find each other. On such a network this Mac can't find the iPhone. Mobster listens for a couple of seconds for what phones, TVs, speakers, printers and computers announce on the network. Hearing nothing on a network that's up, it says:

> This network stops devices from seeing each other. Use the cable or your phone's hotspot.

`mobster doctor`, `mobster wifi probe`, the Wi-Fi tile on Add a device and each device's Rules all say it. The check only listens through macOS's own Bonjour service, and sends nothing to the phone.

## How the link stays private

Apple's CoreDevice tunnel encrypts and authenticates the link between this Mac and the phone. Mobster adds no encryption of its own on it, and checks the route before it uses it:

* **The address is the phone's own.** It must be in `fd00::/8`, and Xcode's device service must report the same UDID for it as the phone you set up. Otherwise Mobster starts nothing and says "CoreDevice gave Mobster another iPhone's Wi-Fi address", and the phone stays on the cable.
* **The route is the tunnel.** The `utun` interface must hold an address on the same network as the phone's (a `/64` or narrower), or a point-to-point address whose peer is the phone's. Mobster refuses a default route and a `utun` that macOS marks as a VPN. It checks before it starts the helper app over Wi-Fi and every 10 seconds while it runs, and stops using Wi-Fi once no task is running when the route stops passing. These checks refuse every route Mobster can tell apart from Apple's tunnel, and don't prove that the interface is Apple's tunnel.
* **The helper app binds to the tunnel.** Mobster starts it on the phone's `fd00::/8` address, not its Wi-Fi address. It answers only a request whose `Host` is `127.0.0.1`, `localhost` or `[::1]`, and refuses one with an `Origin` header, such as a web page's. Any program on this Mac can still send those headers.
* **Your network can't reach it.** On this Mac, a relay listens on `127.0.0.1` only, on the phone's usual ports (`8100` and `9100`, or `8101` and `9101` for a second phone). After the helper answers, Mobster checks ports 8100 and 9100 at the phone addresses it can resolve, and stops the helper if one accepts. On the default gateway, only an answer from the helper app stops it. The helper stays stopped until you start it again, and `error` in its state says why.
* **No plain TCP.** Mobster never uses usbmux over the network (`iproxy -n`), which would be plain TCP on your network.

The approval rules are the same as over USB, and Mobster never unlocks the phone.

## When it doesn't work

| What you see | What to do |
| - | - |
| Plug Work iPhone into this Mac with a cable to turn on Wi-Fi for it. | Plug it in, unlock it and tap Trust if it asks, then try again. |
| Work iPhone doesn't trust this Mac yet. | Unlock it and tap Trust, then try again. |
| Mobster couldn't turn on Wi-Fi for Work iPhone by itself. | In Xcode, open Window › Devices and Simulators, select it and tick Connect via network. |
| Work iPhone isn't reachable over Wi-Fi. | Keep it unlocked and on the same Wi-Fi as this Mac, or plug it in. |
| Work iPhone needs you to start the helper app over Wi-Fi. | Unlock it. Use Face ID or its passcode when asked. Or connect it to your Mac with a cable. |
| Mobster stopped using Wi-Fi for Work iPhone: this Mac no longer reaches it through the encrypted link. | Turn off any VPN on this Mac, or plug Work iPhone in. |
| The encrypted link to Work iPhone isn't up yet. | Unlock it and keep it on the same Wi-Fi as this Mac. Mobster tries again by itself. |
| Wi-Fi isn't available for this iPhone yet. | Plug it in to use it now. |
| Xcode's device service stopped answering. | Plug the phone in once, or restart this Mac if it keeps happening. |
| Your iPhone went out of reach over Wi-Fi, so Mobster stopped. | Keep it unlocked and on the same Wi-Fi as this Mac, or plug it in, then try again. |
| CoreDevice gave Mobster another iPhone's Wi-Fi address for Work iPhone, so Mobster didn't use it. | Plug it in. Mobster tries Wi-Fi again by itself. |
| This network stops devices from seeing each other. | Use the cable or your phone's hotspot. |
| macOS doesn't let Mobster reach devices on your network. | Turn on Mobster in System Settings › Privacy & Security › Local Network. |
| A VPN on this Mac can keep it and Work iPhone apart. | Turn the VPN off, or use the cable. |
| Work iPhone still accepts Wi-Fi connections from Macs it trusts: Mobster turns its Connect via network switch off only over the cable. | Plug Work iPhone in and unlock it, then turn off Wi-Fi for it again. |
| Mobster couldn't turn off Work iPhone's Connect via network switch, so it still accepts Wi-Fi connections from Macs it trusts. | Unlock Work iPhone, keep it plugged in and turn off Wi-Fi for it again, or untick Connect via network for it in Xcode › Window › Devices and Simulators. |
| Work iPhone may still accept Wi-Fi connections from Macs it trusts: Connect via network was turned on for it in Xcode, so Mobster left it on. | In Xcode, open Window › Devices and Simulators, select Work iPhone and untick Connect via network. |

For a phone with Wi-Fi on, `mobster doctor` adds whether Xcode's device service sees it over the network, Developer Mode, whether macOS lets Mobster reach your network, a warning when a VPN is on, and whether this network lets devices see each other.

The phone has to be awake for Wi-Fi. For scheduled workflows, keep it unlocked and on the charger.

## Control Wi-Fi from a script

Every route needs the API token.

| Route | Body | Answer |
| - | - | - |
| `GET /api/wireless` | | `wifiTransport`, `probe` (the last `mobster wifi probe` on this Mac: `state` `passed`, `failed` or `not_run`, `at`, `reason` and the phone's `udid`), `network` (null until checked, or `state` and `problem`), and per phone: `id`, `probe`, `udid`, `name`, `primary`, `enabled`, `transport` (`usb`, `wifi` or null), `tunnel` (`up`, `connecting`, `down` or `unknown`), `reachable`, `lastSeenAt`, `lastCheck` and `problem` (null, or `code`, `message` and `fix`) |
| `GET /api/wireless/network` | | `network`: checks now, in about 3 seconds at most, whether this network lets devices see each other. `state` is `ok`, `blocked`, `no_permission`, `vpn`, `offline` or `unknown` |
| `POST /api/wireless` | `{"wifiTransport": true}` | turns Wi-Fi for iPhones on or off, and saves `MOBSTER_WIFI_TRANSPORT=1` or `0` in the env file |
| `POST /api/devices/DEVICE/wifi` | `{"enabled": true}` | `device`. Turning it on needs the phone plugged in and trusting this Mac, else 409 `needs_cable` or `not_trusted`. `next` (`code`, `message`, `fix`) is the one step left: `needs_xcode` after turning it on, `still_on`, `off_failed` or `xcode_on` after turning it off |
| `POST /api/wireless/reconnect` | `{"device": "Work iPhone"}` | 202. Looks again now, without waiting out the backoff |
| `POST /api/wireless/probe` | `{"device": "Work iPhone", "start": false}` (both optional) | 202 with `device`, `accepted` and `check`. Runs the checks of `mobster wifi probe` in the background, one phone at a time. `lastCheck.state` ends `passed`, `failed` (with `next` for the step that failed), `plugged_in` (unplug the cable first) or `timeout` (over 180 seconds). It starts the helper app over Wi-Fi only with `"start": true`. 409 `busy` while a task holds the phone, 409 `probe_running` while another check runs |

With Wi-Fi for iPhones on, each iPhone in `GET /api/devices` also has `transport` and `wifi` (`enabled`, `reachable`), and `GET /api/events?topics=devices` sends `transport_changed` with `device`, `transport` and `reachable` when a phone moves between the cable and Wi-Fi.


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