Skip to main content
Back

Cyber Monday Deal: Get 20% off all AlphaSignal Pro subscriptions. Ends soon.

Phone Harness Lets AI Agents Control Real iPhones Without Jailbreaking

A tiny Python harness lets Claude Code or Codex drive a real iPhone through macOS iPhone Mirroring, or any Android over adb, with no jailbreak and nothing installed on the phone.

Pro

Repo, Full Access
  • phone-harness lets Claude Code, Codex, or any agent control a real iPhone or Android.
  • iPhone works through macOS iPhone Mirroring; Android works over adb — no jailbreak, no Xcode, no sideloaded app.
  • Uses Apple Vision OCR for perception and HID-level mouse and keyboard events for taps and typing.
  • Same Python helpers work across both platforms: open_app, tap_text, type_text, ocr, swipe.
  • Limits: locked phones block mirroring, no multi-touch, no Face ID, DRM video renders black.
  • MIT-licensed, ~3.6k stars, with a hosted Phone Harness Cloud for fleets of devices.

The open-source phone-harness project has passed 3,600 GitHub stars by giving coding agents control of real iPhones and Android devices without a jailbreak, Xcode, or a phone-side app. On iOS, it captures the iPhone Mirroring window, reads it with optical character recognition, and sends synthetic mouse and keyboard input. On Android, it uses ADB. Developers can automate mobile workflows without instrumenting the target app or maintaining a conventional mobile testing stack.

Apple supplied the transport

macOS Sequoia’s iPhone Mirroring feature displays an iPhone as an ordinary Mac window and translates mouse and keyboard input into phone interactions. Phone Harness treats that window as an automation surface, leaving Apple to manage the device connection, display stream, and input forwarding.

Each iOS action follows a capture, interpret, act, and verify loop. The harness takes a screenshot, uses Apple’s Vision framework to extract visible text and its coordinates, and sends HID-level events to the corresponding location. Because the screen pixels provide the state, the system requires no DOM, semantic UI tree, WebDriverAgent session, or app installed on the iPhone.

The control loop in code

The CLI reads Python from standard input and pre-imports helpers such as open_app, tap_text, ocr, and type_text. A basic Notes workflow looks like this:

phone-harness <<'PY'
open_app("Notes")
tap_text("New Note")
type_text("hello from the harness")
print([o["text"] for o in ocr()][:10])
PY

Reliable agents should capture the screen again after every action, confirm that the expected text or state appeared, and recover when a tap misses. The same helper calls work across both platforms, while phone-harness config set platform ios|android selects the default transport.

One API, two back ends

Platform Screen data Input Host requirements
iPhone iPhone Mirroring window and Apple Vision OCR HID-level mouse and keyboard events A compatible Mac and iPhone, iPhone Mirroring, Accessibility permission, and Screen Recording permission
Android ADB screenshots and the device accessibility tree ADB input commands ADB, developer options, and device authorization over USB or Wi-Fi

The iOS path relies on visible text and coordinates because Apple does not expose the phone’s accessibility hierarchy through iPhone Mirroring. Android provides more structured information through ADB, but Phone Harness presents both implementations through the same Python-facing API.

Pairing keeps a human involved

The repository includes a bootstrap prompt for Claude Code and Codex that directs the agent to clone the project, install the CLI on the user’s PATH, register the provided skill, and guide the remaining setup. Several steps still require direct approval from the device owner:

  1. Install the host tools. Set up the CLI and select the iOS or Android platform.
  2. Pair the device. Configure iPhone Mirroring or authorize the computer for ADB access.
  3. Grant macOS permissions. The iOS transport needs Accessibility to inject input and Screen Recording to capture the mirrored display.
  4. Check the chain. Run phone-harness --doctor to verify capture, OCR, input, and device connectivity.

Device pairing and connection approval remain human tasks. Unlocking an iPhone also pauses its mirrored session, while an Android device protected by a PIN may require manual unlocking before automation can continue.

Pixels impose hard limits

Text-heavy interfaces such as Notes, Messages, Maps, forms, and settings screens fit the OCR-driven approach because visible labels produce tap-ready coordinates. The README demo uses the request, “Buy me a Waymo to Delah Coffee from my current location,” to show an agent navigating a consumer app on a logged-in device.

  • Unlabeled controls need vision. OCR cannot identify an icon without adjacent text, so the agent must inspect a screenshot with a vision-capable model or use explicit coordinates.
  • Repeated labels are ambiguous. Multiple buttons with the same text require position filtering or additional visual reasoning.
  • Multi-touch is unavailable. Pinch, rotate, and other multi-finger gestures are outside the current input model.
  • Protected flows remain blocked. Camera, Face ID, and similar hardware-mediated interactions require human involvement.
  • DRM video appears black. Screen-capture protections prevent the harness from reading protected media.
  • Layout changes can break scripts. Different screen sizes, languages, dynamic content, and redesigned interfaces can move or rename targets.

Pixel-driven automation suits exploratory testing, black-box workflows, and tasks spanning third-party apps. Teams that require stable selectors, deterministic assertions, detailed test telemetry, or unattended CI runs may still need native testing frameworks alongside the harness.

Terminal permissions widen the risk

The iOS transport grants Accessibility and Screen Recording privileges to the terminal application running the harness. Scripts and agent tools launched through that authorized terminal may operate under those permissions, allowing them to capture sensitive on-screen information or inject input. Android’s ADB authorization also gives the connected host broad control over the device.

  • Use dedicated test devices and accounts where possible.
  • Require confirmation before purchases, messages, account changes, or destructive actions.
  • Review generated scripts before granting an agent long-running access.
  • Keep secrets and unrelated personal data off the automated device.
  • Revoke macOS permissions and ADB authorizations when access is no longer needed.

Why agents needed a phone bridge

Browser automation frameworks, Anthropic’s computer-use tools, and OpenAI’s Operator can interact with websites and desktop interfaces, while local iPhone automation usually requires more infrastructure. Appium-based iOS testing commonly involves Xcode, code signing, and WebDriverAgent; hosted device farms add cost and operational overhead. Phone Harness offers a local route to a real, already logged-in iPhone by reusing the mirroring capability built into macOS.

The project is MIT-licensed Python and is distributed through PyPI. The local CLI is free, while Phone Harness Cloud provides hosted iPhone and Android fleets with real phone numbers and support for two-factor authentication flows.

Where the approach fits

  • Exploratory and black-box QA: Exercise complete workflows without adding test hooks to the app.
  • Personal workflow prototypes: Automate ride requests, message triage, forms, and app-only tasks, subject to each service’s terms and confirmation requirements.
  • Vision-language model benchmarks: Use a real mobile interface as the environment and measure how well a model chooses and verifies actions.
  • Agent-planning research: Study decision-making in interfaces where the agent sees only screenshots, OCR output, and action results.
  • Support and operations tooling: Automate repetitive work in mobile services that lack an official API.

Phone Harness works best when a workflow is visible, text-labeled, and compatible with taps, swipes, and typing. Its practical contribution is a small Python interface over capabilities already present in macOS and ADB, giving developers a direct way to prototype agents that operate real phones.