mobilerun-ios CLI to connect your own iPhone to Mobilerun so it can run tasks from the Playground or API. This guide is for developers with a Mac, Xcode, and an iPhone they can plug in over USB. Once connected, the iPhone shows up as a Personal Phone on the Devices page.
Requirements
- A Mobilerun account with a Personal Phone subscription
- macOS with Xcode installed
- An iPhone connected via USB
- An Apple ID with signing capability (personal team is fine)
Signing with a personal / free team comes with Apple-imposed limits: builds expire after 7 days, after which you need to rebuild in Xcode and re-trust the certificate on the device, and you can sign for at most 3 devices. A paid Apple Developer account ($99/year) lifts both limits.
1. Enable Developer Mode on your iPhone
Developer Mode lets Xcode install and launch development builds (like WebDriverAgent) on your device.- On the iPhone, open Settings → Privacy & Security → Developer Mode.
- Toggle Developer Mode on.
- Restart the iPhone when prompted, then confirm the prompt after it boots.
The Developer Mode entry only appears after the iPhone has been connected at least once to a Mac running Xcode. If you don’t see it, plug the device in, open Xcode, then check Settings again.
2. Configure your iPhone for long-lived connections
A Personal Phone is meant to stay online for hours or days at a time. Three iPhone settings make the difference between a connection that survives and one that needs constant babysitting:Disable Auto-Lock
When the iPhone locks, the screen goes black and the session goes offline. Set Settings → Display & Brightness → Auto-Lock to Never.Enable automatic time zone
Set Settings → General → Date & Time → Set Automatically to on. This keeps the device’s time zone in sync with its (simulated) location. Writing the time zone manually does not work on non-jailbroken devices, so automatic time zone is the only reliable way to keep it matching the location.Remove the passcode (for unattended 24/7 setups)
Only do this if you plan to leave the device running around the clock with nobody nearby to unlock it. For supervised use, keep your passcode and skip this. After running for a while, the XCTest session that hosts WebDriverAgent crashes or expires and has to be restarted. Mobilerun restarts it automatically — but only if the device has no passcode. With a passcode set, the relaunched session lands on the lock screen and the connection stays down until someone enters the passcode by hand. If you’re around to unlock the device when that happens, you don’t need to remove it. For a fully unattended device, turn the passcode off under Settings → Face ID & Passcode → Turn Passcode Off.3. Download Mobilerun WebDriverAgent
Mobilerun controls your iPhone through WebDriverAgent (WDA), an open-source project that exposes input injection and screenshots on iOS. We maintain our own fork, Mobilerun WebDriverAgent, tuned for exactly this job: higher-quality streaming, lower-latency accessibility tree fetching and touch input, with more features landing over time. Clone it:The upstream Appium WebDriverAgent works too, but with higher latency and lower streaming FPS.
4. Build and install WebDriverAgent on your iPhone with Xcode
This is the trickiest step. Take it slow — most connection issues later on trace back to signing or trust problems here.-
Open
WebDriverAgent.xcodeprojin Xcode. - In the top bar, select your connected iPhone as the run destination.
- Choose the WebDriverAgentRunner scheme.
-
Set up signing for the runner and its extension target. For both
WebDriverAgentRunnerandWebDriverAgentBroadcast, select the target, open the Signing & Capabilities tab, and:- Tick Automatically manage signing.
- Pick your Apple ID / Team from the dropdown.
WebDriverAgentBroadcastis an app extension that ships inside the runner app — it’s what enables high-FPS screen streaming. It builds and embeds automatically; it just needs a team selected so Xcode can sign it. Skipping it fails the build with “Signing for ‘WebDriverAgentBroadcast’ requires a development team.” - Press Cmd+U to build-for-testing. Xcode builds the runner with the extension embedded and installs it onto the iPhone.
- On the iPhone, trust the developer certificate: Settings → General → VPN & Device Management → tap your team → Trust.
5. Install the mobilerun-ios CLI
Pick whichever you prefer:PATH (brew puts it in the Homebrew prefix; the curl installer uses /usr/local/bin and may prompt for sudo).
Verify the install:
6. Log in to Mobilerun
~/.mobilerun-ios/config.yaml (chmod 0600). Confirm with:
mobilerun-ios logout to clear the stored token.
For CI/headless setups where opening a browser isn’t possible, skip
login and export an API key from the API Keys tab instead:7. List your connected iPhones
With the iPhone plugged in and unlocked, list everythingmobilerun-ios can see:
PORTAL column shows running (pid=…) once a background portal is up (see below).
8. Start the connection
Connect the iPhone by passing its UDID:Run in the background
Pass-d / --detach to release the terminal while the portal stays up:
mobilerun-ios list shows the portal as running in the PORTAL column. Stop it later with:
mobilerun-ios stop (no UDID) to stop every background portal.
Verify it worked
Open Devices in the Mobilerun dashboard — your iPhone should show up as a connected Personal Phone. Start a task from the Playground and select it to confirm end-to-end control.Troubleshooting
WebDriverAgentRunner crashes on launch
WebDriverAgentRunner crashes on launch
The CLI surfaces this as:Re-sign the
WebDriverAgentRunner target in Xcode and make sure the developer certificate is trusted under Settings → General → VPN & Device Management, then press Cmd+U again.`mobilerun-ios list` shows no devices
`mobilerun-ios list` shows no devices
Confirm your USB cable supports data (not charging-only), the iPhone is unlocked, and you accepted the Trust This Computer prompt.
Auth failures
Auth failures
Re-run
mobilerun-ios login and confirm with mobilerun-ios whoami. For API-key setups, verify the token in the API Keys tab and that MOBILERUN_IOS_TOKEN is exported in the same shell.iPhone goes offline or screen goes black during a session
iPhone goes offline or screen goes black during a session
Auto-lock put the device to sleep. Disable it under Settings → Display & Brightness → Auto-Lock → Never while the iPhone is connected to Mobilerun (see step 2).
Connection drops after a few hours and the device sits on the lock screen
Connection drops after a few hours and the device sits on the lock screen
The XCTest session hosting WebDriverAgent expired and was restarted, but a passcode is blocking the relaunch. Unlock the device to let the session reconnect. For an unattended 24/7 device where no one is around to do that, remove the passcode (see step 2) so the session can heal itself automatically.
Known issues
- TikTok crashes automation. Dumping TikTok’s accessibility tree times out, which crashes the Mobilerun automation session. Avoid tasks that drive the TikTok app for now.
Need Help?
If you run into any issues or need further assistance, reach out to us:- Discord: discord.gg/droidrun
- Email: contact@mobilerun.ai