首次配置必须在 Xcode 登录 Apple ID、在 iPhone 上信任并开启开发者模式,这些步骤无法由终端代劳;安装后若 phone_* 工具未加载需新开一个会话;部分银行、支付类 App 会屏蔽截屏,只能看到元素线框而非实时画面。
iphone-use
leeguooooo活跃维护让 Claude Code、Codex 等 AI agent 通过 MCP 直接操控真实 iPhone,读屏、点击、输入、滑动都走 USB 或 Wi-Fi,自带 XCTest runner 且支持可回放的 App flow。
响应快 省Token, Let AI agents (Claude Code, Codex, any MCP client) drive a real iPhone · 让 AI agent 操作真实 iPhone:读屏、点击、输入、滑动,USB 或 Wi-Fi,自有 XCTest runner,可回放的 App flow。Open source, self-hosted on macOS.
curl -fsSL https://raw.githubusercontent.com/leeguooooo/iphone-use/main/install.sh | sh
iphone-use doctor需要 macOS 15+ 的 Mac,Xcode 登录 Apple ID(免费账号即可);iPhone 需 iOS 15+ 并开启开发者模式,首次配置需 USB 线连接并解锁。README 未提及显存或 GPU 要求。
让 Claude Code、Codex 等 MCP 客户端直接操作真实 iPhone,读屏、点击、输入、滑动
让 Claude Code、Codex 等 AI agent 通过 MCP 直接操控真实 iPhone,读屏、点击、输入、滑动都走 USB 或 Wi-Fi,自带 XCTest runner 且支持可回放的 App flow。
核心能力
- 把屏幕读成无障碍树文本而非像素截图
- 自带 XCTest runner 装在手机上执行点击输入
- 一次任务可录成 flow,单次调用回放不耗 token
- USB 首次配置后可通过加密隧道走 Wi-Fi
- 每个动作明确回报已生效、未发送或未知
容易踩的坑
- v0.28.1最新正式版2026-11-06 · 2026-11-06 17:02 UTC
更新内容
- 「结束控制」通知不再以横幅盖住被控 App(#413、#418):通知只进通知中心和锁屏,长按点「结束控制」照常能用,但不会再被误点而断开控制。
- iOS 结束 runner 时不再报成“在手机上退出”(#413、#418):runner 被系统看门狗杀掉或崩溃时,
/agent/status报runner_parked_reason: "crashed",ended_on_phone: false,并提示可以直接重连。以前会被报成ended_on_phone,agent 会误以为要先问人。同时按住两个音量键退出,仍然报ended_on_phone。 - MCP 客户端关闭时交还设备租约(#414、#419):
iphone-use-mcp退出前会交还本进程持有的租约,其他会话不用再等满 300 秒。只释放确实属于本进程的租约;设置了IPHONE_USE_OWNER时不自动释放。
v0.28.0 的重点(自动清理手机上被 XCTest 录屏占掉的空间)见 #417。
- The "End control" notice no longer shows as a banner over the app being driven (#413, #418); it stays in Notification Center and on the Lock Screen.
- A runner killed by iOS is no longer reported as ended on the phone (#413, #418): status says
runner_parked_reason: "crashed",ended_on_phone: false, and that reconnecting is fine. The both-volume-keys exit still reportsended_on_phone. - The MCP server gives back its phone lease when the client closes (#414, #419), so another session does not wait out the 300 s lease. Only a lease the daemon reports as this process's own is released, and never under a shared
IPHONE_USE_OWNER.
What's Changed
- fix(mcp): 客户端关闭时交还本进程持有的设备租约 (#414) by @leeguooooo in https://github.com/leeguooooo/iphone-use/pull/419
- fix(runner): 结束控制通知不再以横幅盖住被控 App;看门狗杀掉 runner 不再报 ended_on_phone (#413) by @leeguooooo in https://github.com/leeguooooo/iphone-use/pull/418
Full Changelog: https://github.com/leeguooooo/iphone-use/compare/v0.28.0...v0.28.1
- v0.28.0v0.28.0 — 自动收回被 XCTest 录屏占掉的 iPhone 空间2026-11-06 · 2026-11-06 13:33 UTC
查看更新说明
重点:自动收回手机上被 XCTest 录屏占掉的空间
v0.27.40 之前,iphone-use 的 runner 每次驱动手机时都会被 XCTest 全程录屏。runner 的测试永远不会“通过”,所以这些录像一直留在 Apple 测试服务 testmanagerd 的目录
tmp/Attachments里。- 能占多少:我们自己的一台 iPhone 17 Pro Max 上有 60.57 GB、3617 个文件。
- 用户看不到:iOS 设置里只显示为「系统数据」,不会单独列出来。
- 用户删不掉:重启不会清;空间不够时 iOS 也不会清,因为它不算可清除空间。iPhone 上没有任何地方能手动删除。
v0.27.40(#410)已经不再录屏。v0.28.0 起,iphone-use 会把以前留下的录像清掉:
- daemon 启动约 90 秒后清一次,之后每 6 小时检查一次;
- 只处理
tmp/Attachments里 10 分钟内没有改动过的文件; - 手机没连上就跳过,下一轮再试。
不需要任何操作。开了自动更新的话今晚会自动升级;也可以现在执行
iphone-use upgrade。升级后手机保持连接(USB 或 Wi‑Fi 都行),几分钟内就会开始清理,清完后「系统数据」会相应下降,iOS 重新统计可能要等一会儿。相关:#415(问题)、#416(修复)。之前的修复:#410(不再录屏)、#408 / #409(Mac 端的诊断包和 DerivedData 堆积)。
Highlight: iphone-use now frees the iPhone space taken by old XCTest screen recordings
Before v0.27.40, XCTest screen-recorded every runner session. The runner's test never passes, so the recordings were kept in testmanagerd's
tmp/Attachmentson the phone — about 60 GB (3617 files) on one of our iPhones. iOS Settings only shows them as "System Data"; they are not purgeable, a reboot does not remove them, and there is no way to delete them on the phone.v0.27.40 (#410) stopped the recording. From v0.28.0 the daemon removes what is already there: about 90 s after it starts and then every 6 hours, it empties attachments that have not changed for 10 minutes. Nothing to do: auto-update installs it tonight, or run
iphone-use upgradenow and keep the phone connected (USB or Wi‑Fi).Issue #415, fix #416.
What's Changed
- fix(setup): 自动清掉手机上旧版留下的 XCTest 录屏附件 (#415) by @leeguooooo in https://github.com/leeguooooo/iphone-use/pull/416
Full Changelog: https://github.com/leeguooooo/iphone-use/compare/v0.27.41...v0.28.0
- v0.27.412026-11-06 · 2026-11-06 07:40 UTC
查看更新说明
What's Changed
- fix(setup): 手机存储满时直接提示,不再反复重编译 runner (#402) by @leeguooooo in https://github.com/leeguooooo/iphone-use/pull/411
- fix(input): 点击避开屏幕底部 Home 指示条区域,底边的行先滚出来再点 by @leeguooooo in https://github.com/leeguooooo/iphone-use/pull/412
Full Changelog: https://github.com/leeguooooo/iphone-use/compare/v0.27.40...v0.27.41
- v0.27.402026-11-05 · 2026-11-05 01:25 UTC
查看更新说明
What's Changed
- fix(setup): runner 测试不再在手机上全程录屏 (#402) by @leeguooooo in https://github.com/leeguooooo/iphone-use/pull/410
Full Changelog: https://github.com/leeguooooo/iphone-use/compare/v0.27.39...v0.27.40
- v0.27.392026-11-04 · 2026-11-04 15:04 UTC
查看更新说明
What's Changed
- fix(setup): daemon 启动后和每 6 小时清理 runner 启动日志 (#402) by @leeguooooo in https://github.com/leeguooooo/iphone-use/pull/409
Full Changelog: https://github.com/leeguooooo/iphone-use/compare/v0.27.38...v0.27.39
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
curl -fsSL https://raw.githubusercontent.com/leeguooooo/iphone-use/main/install.sh | sh
https://github.com/user-attachments/assets/ee298774-bf3e-4fd0-9a08-481b20904f61
1-minute demo, real iPhone recordings · 中文版
Advertisement · Available
Advertise here
Showcase your product here and support ongoing maintenance.
Ask about advertising · [email protected]
Paid setup and project sponsorship
Need help setting up a real iPhone, connecting your agent or creating an iOS app test flow? Email us with your environment, the workflow and expected result, and where you are stuck. We review feasibility and agree on scope, acceptance criteria and a quote before work starts.
Ask about paid setup · Discuss sponsorship · [email protected]
Want to support ongoing maintenance? Email us to discuss a one-time or recurring contribution.
Community bug reports and feature requests remain welcome on GitHub. Please keep credentials and private account data out of inquiries.
MCP calls can choose an installed local instance with instance:"i13" (including
phone_status and input tools); phone_instances lists them without reconnecting.
Omit it to keep the configured daemon. Missing instances fail without selecting a
different phone. See per-call instance routing.
Why iphone-use
- Any app, no API needed. It works on Health, banking and payment apps (even the ones that black out screen capture), chat apps and your own app under test.
- USB or Wi-Fi. Set the phone up once with a cable; after that it can be driven over Wi-Fi through an encrypted tunnel.
- Old iPhones too. iOS 15 and later, without updating the phone.
- Fast. Its own XCTest device runner reads the screen in about 0.1 s. A tap that returns the settled screen takes about 1.9 s (numbers).
- Honest results. Every action reports whether it was applied, not sent, or unknown, and whether a retry is safe. Taps on covered elements are refused, not passed off as done.
- Replayable flows. A task done once becomes a flow that replays in one call, with no model and no tokens.
- Remote control for people, too. Drive the phone yourself from a browser or another iPhone, on the LAN or from anywhere: a live H.264 screen, mouse and keyboard, and pairing by QR code. Agents and people share one phone without stepping on each other (details).
- Watch the agent live. The phone's screen shows in the agent host's side panel (where MCP Apps is supported), in a browser, or in the iOS app.
- Nothing on the Mac moves. It never touches the Mac's screen, cursor or focus.
What you can ask
Open Health and tell me how many steps I walked each day this week.
Find the newest message from Mom in WeChat and read it to me.
Collect every transaction on this bank statement page, all the way to the end.
Write this 2,000-word draft into a new note in Notes.
Run my app's login test on the real phone and tell me which step fails.
The agent finds an app by its name (launch_app {"app": "Health"}) and types long text (up to 20,000 characters) in one step. It can read a list across pages and say whether it reached the end.
How it works
Claude Code / Codex / any MCP client ──MCP──┐
scripts and other agents ─────────────HTTP──┤
▼
iphone-use daemon on your Mac ──USB or Wi-Fi──▶ XCTest runner on the iPhone
▲
you, in a browser or the iOS app ───────────┘
One daemon per phone runs on the Mac. It reads the screen as an accessibility tree (text, not pixels), sends taps and typing through a small XCTest runner it installs on the phone, and checks that the screen has settled before it answers. Agents and people go through the same daemon, and one of them holds the phone at a time.
Install
You need
- A Mac with macOS 15 or later, and Xcode signed in to an Apple ID (a free one works).
- An iPhone with iOS 15 or later and Developer Mode on (Settings → Privacy & Security → Developer Mode).
- A USB cable for the first setup. Plug the iPhone in and unlock it before you install.
The installer then sets the phone up and shows an agent opening Settings and reading it. It registers the MCP server with Claude Code and Codex, and with Cursor and Claude Desktop when they are installed (IPHONE_USE_NO_CLIENT_SETUP=1 skips those two), and opens the control page in your browser with a one-time sign-in, so there is no password to copy. If anything is missing, it says what and how to fix it.
iphone-use status # is the phone ready for agents?
iphone-use doctor # what is missing, and how to fix it
iphone-use setup # set the phone up again (after a new iPhone or Xcode)
iphone-use try # a harmless check: open Settings, read the screen, go Home
iphone-use login # sign a browser in again, with a QR code for the iPhone
iphone-use upgrade # update everything
~/.iphone-use/uninstall.sh --dry-run # what uninstalling would remove (drop --dry-run to do it)
Or ask your agent to install it
Paste this into Codex or Claude Code on the Mac the iPhone is plugged into:
Install iphone-use (https://github.com/leeguooooo/iphone-use) on this Mac so you can drive my iPhone.
1. Run: curl -fsSL https://raw.githubusercontent.com/leeguooooo/iphone-use/main/install.sh | sh
2. Run `iphone-use doctor`. Fix what it reports that can be fixed from the terminal, and run
`iphone-use setup` when it tells you to.
3. Some steps only I can do: signing in to an Apple ID in Xcode, tapping Trust on the iPhone,
turning on Developer Mode, unlocking the phone. For those, stop, tell me exactly what to do,
and wait until I say it is done. Never ask me for a password or a code.
4. Run `iphone-use doctor` again until nothing is missing, then `iphone-use try`.
5. If the phone_* tools are not loaded in this chat yet, tell me to start a new chat.
Codex and Claude Code plugins
Each adds the skill and the MCP server; they still need the install above:
codex plugin marketplace add leeguooooo/iphone-use && codex plugin add iphone-use@iphone-use
In Claude Code:
/plugin marketplace add leeguooooo/iphone-use
/plugin install iphone-use@iphone-use
Remote control for people
The same daemon that serves agents lets you drive the phone yourself:
- From a browser. The live screen arrives as H.264 encoded on the phone: native resolution at about 50 fps on the LAN, and a lighter mode for slow links. Click to tap, drag to swipe, hold to long-press, scroll with the wheel or trackpad. Type straight into the phone with your input method, and ⌘V pastes. The Controls panel lists the screen's elements so you can tap by label, and the Flow panel records what you do as a replayable flow. The page follows your browser's language (English or Chinese), with a switch in the sidebar.
- From another iPhone. The native iOS app (minimum deployment target iOS 15) pairs by scanning a QR code on the Mac's page, with no address or password to type. It plays the screen with the hardware decoder and switches between your phones. Install it with
iphone-use setup-app, which signs it with your own team; with a paid team the app also controls its own phone with no Mac (details). - Screens hidden from capture. Banking and payment apps black out screen capture; there you see a live wireframe of the screen's elements instead of a blank picture, and you can still tap through it.
- From any network.
iphone-use remote tailscale onputs the phone on your tailnet as its own device (no Tailscale app needed on the Mac), andiphone-use remote cloudflare onopens a Cloudflare Tunnel; then browse to the address it prints, scaniphone-use remote pairwith the app, or point agents at it, over cellular or any Wi-Fi (details). - No collisions. A phone has one owner at a time. While you are in control, an agent waits or is told who holds the phone, and the reverse is true too.
Nothing on the Mac moves while you do it: no window takes focus and the cursor stays put.
Use it from an agent
To save a screenshot on the phone for use in another app, call
phone_shortcut {"name":"save_screenshot"}. It requests an iOS system capture
in Photos; check the new image before claiming it saved. phone_screenshot
returns an image to the caller. Saving requires an updated native Runner.
A daemon on your Mac drives the phone and offers the same control in three forms:
- an MCP server for Claude Code, Codex, Claude Desktop, Cursor and other MCP clients;
- an HTTP API for agents and scripts (
/agent/*); - a web page and a native iOS app for people (remote control).
The installer registers the MCP server with Claude Code, Codex, Cursor and Claude Desktop when they are present (IPHONE_USE_NO_CLIENT_SETUP=1 leaves Cursor and Claude Desktop alone). Any other MCP client needs only the command; on this Mac the server finds the daemon and its token by itself:
{
"mcpServers": {
"iphone-use": {
"command": "/Users/YOU/Applications/iPhoneUse.app/Contents/MacOS/iphone-use-mcp"
}
}
}
Use the absolute path (replace YOU) and merge the entry into the file; keep the servers already there.
-
Cursor:
~/.cursor/mcp.json(or.cursor/mcp.jsonin a project), themcpServersblock above. -
Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json, themcpServersblock above; quit and reopen the app. -
Gemini CLI:
~/.gemini/settings.json(or.gemini/settings.jsonin a project), themcpServersblock above. -
Windsurf / Devin Desktop:
~/.codeium/windsurf/mcp_config.json(newer builds:~/.config/devin/mcp_config.json), themcpServersblock above. -
VS Code / Copilot:
.vscode/mcp.jsonin a workspace, or MCP: Open User Configuration for every workspace. The key isservers:{ "servers": { "iphone-use": { "type": "stdio", "command": "/Users/YOU/Applications/iPhoneUse.app/Contents/MacOS/iphone-use-mcp" } } } -
opencode:
~/.config/opencode/opencode.json(oropencode.jsonin a project). The key ismcpand the command is an array:{ "$schema": "https://opencode.ai/config.json", "mcp": { "iphone-use": { "type": "local", "command": ["/Users/YOU/Applications/iPhoneUse.app/Contents/MacOS/iphone-use-mcp"], "enabled": true } } }
Or call the HTTP API directly:
AUTH="Authorization: Bearer $TOKEN"; CTL="X-Phone-Control: 1"
curl -s -H "$AUTH" $HOST/agent/elements # the screen as text + a snapshot token
curl -s -H "$AUTH" -H "$CTL" -X POST "$HOST/agent/input?return=delta" \
-d '{"type":"tap","element":7,"snapshot":"…"}' # tap, then what changed (~2 s)
For app developers and testers the same tools also read the phone's logs and crash reports, record the screen to MP4, install a build (.ipa, .app or an https link), set a simulated location, and keep per-app notes that agents read when they enter the app. IPHONE_USE_MCP_TOOLS=core hides those developer tools, readonly exposes only the tools that read, and iphone-use-mcp --listen 127.0.0.1:PORT serves MCP over HTTP. A loopback listener is reachable only from the same Mac; for a client on another machine, put it behind an authenticated tunnel, or listen on another address with IPHONE_USE_MCP_TOKEN set (it is required off loopback).
No phone at hand? While you develop, drive an iOS Simulator the same way (preview, needs Xcode): iphone-use simulator start "iPhone 16 Pro" builds and starts everything, then point the agent at it with claude mcp add iphone-sim -e IPHONE_USE_INSTANCE=sim -- iphone-use-mcp. See Simulators.
See the MCP tools and the Agent API reference.
Safety and privacy
- Secrets stay with you. For logins, passcodes and Face ID the agent stops and asks you to finish on the phone. It never asks for the password or the code.
- Limits the agent cannot talk its way past. The daemon refuses apps you block (
IPHONE_USE_BLOCKED_APPS, for exampleWallet, Passwords) and caps the actions per task (IPHONE_USE_MAX_ACTIONS), whatever the agent's prompt says (details). - You see what it does. The web page shows each action over the live screen in plain words, for example
Tapped “Wi-Fi”. Typed text is never kept, only its length. - Local by default. The daemon listens on
127.0.0.1:44321behind a password, and the runner on the phone accepts only requests signed with a per-launch token. The iOS 15/16 LAN path is unencrypted (security). - No telemetry. This build sends no usage data (telemetry · privacy policy).
phone_home_layout reads the paired phone's persisted home pages, Dock,
folders and widget stacks without opening folders or taking screenshots.
Use page to limit the response. Its page indexes include hidden/Focus-filtered
pages; use fresh UI elements before dragging, rather than treating grid slots
as screen coordinates.
Flows: do a task once, replay it with no model
Tasks you repeat are kept as flows: reviewed per-app scripts that replay without a model, so they cost no tokens. The official registry is leeguooooo/iphone-use-flows. Record a flow in the browser's Flow panel and publish it there with a PR.
Agents find flows on their own: when one enters an app, the response lists that app's flows. After an agent does a multi-step task in an app that has none, it asks whether to save the task as a flow; the daemon has already recorded the steps as a draft. The daemon keeps the registry fresh by itself (IPHONE_USE_FLOWS_NO_AUTO_UPDATE=1 turns that off, IPHONE_USE_FLOWS_NO_SUGGEST=1 silences the save suggestions).
MCP=~/Applications/iPhoneUse.app/Contents/MacOS/iphone-use-mcp
$MCP flow update # sync the registry (sha256-checked)
$MCP flow list # what is available
$MCP flow run health/export-all-zh-cn # replay one; failures say which step and why
$MCP flow draft --out my-task.json # what you just did on the phone, as a draft flow
Flows also make rerunnable test suites ($MCP test suite.yaml, with an exit code ready for CI) and scheduled runs the daemon starts on a cron line ($MCP schedule add): see Testing and scheduled runs.
Speed
iphone-use drives the phone through its own XCTest runner (runner/). It speaks the WebDriverAgent HTTP API, and it is built for speed:
- It reads the screen with one accessibility snapshot of a fixed attribute set, instead of walking the element tree attribute by attribute.
- It synthesizes touches directly and does not wait for the app to go idle before acting; the daemon checks afterwards that the screen has settled.
- It is one small app with a built-in HTTP server and MJPEG stream; there are no extra dependencies on the phone.
Measured on the same iPhone 13 over USB, against agent-device (October 2026):
| iphone-use runner | agent-device | |
|---|---|---|
| Read the screen (accessibility tree) | 0.08–0.135 s | ~0.7 s |
| Tap, then wait for the screen to settle | 1.0 s | 2.8–3.3 s |
Through the full agent API, a tap by label that returns the settled change takes about 1.9 s on an iPhone 17 Pro Max; the WebDriverAgent-based release took 4.2 s. The live view streams at 27–28 fps. Each phone gets its own daemon and runner, so two phones driven at the same time run as fast as either one alone.
More
- Full guide: browser and iOS app, flows and the flow registry, Wi-Fi and iOS 15/16, lifecycle, configuration, security, development.
- Agent API reference · MCP tools · Architecture · Device setup pitfalls · Device runner · Privacy
- Product guide: installation, MCP setup, flows and how it compares.
- Issues and ideas: GitHub issues.
Related MCP servers
- iPhone MCP: another macOS MCP server for real iPhones and simulators.
- ios-mcp: iPhone and iOS Simulator automation through an observe/act/verify loop.
iphone-use focuses on a real device runner, explicit action outcomes and deterministic flow replay. These are independent alternatives, not dependencies or endorsements.
License
PolyForm Shield 1.0.0. This project is source-available. Non-competing use, modification and distribution are permitted subject to the license; using the software to provide a competing product or service, including a free one, is prohibited. See licensing scope and third-party notices.
The *-use family
Small, composable CLIs that give an AI agent hands on one real thing. Same shape
everywhere: curl … install.sh | sh to install, JSON on stdout, and a companion
skill that teaches your agent to drive it — each repo's own README says how to
install its skill, since the right way differs per project and per release.
| Repo | Gives your agent |
|---|---|
| chrome-use | A real browser — logged-in sessions, forms, scraping, screenshots |
| mail-use | Email — read, search, send, triage across Gmail / QQ / 163 / any IMAP |
| wechat-use | WeChat on macOS — send messages, query contacts and history |
| discord-use | Discord — messages, channels, forums, webhooks (REST-only, Rust) |
| cookie-use | Many logged-in accounts per site — capture, switch, apply sessions |
| profile-use | Your personal profile, safely — fill signup / KYC / checkout forms |
| bitwarden-use | Bitwarden / Vaultwarden — headless passkey (FIDO2) login |
| chatgpt-use | Your ChatGPT subscription as a coding-agent backend — no API key |
| computer-use | The macOS desktop itself |
| pixcake-use | Read-only PixCake probing — snapshot / diff / SQLite inspection |
Author
Built by 郭立 (Guo Li / leeguoo) — leeguoo.com · GitHub · X · more tools in the *-use family.
Focused reads and action receipts
phone_subtree reads one native element’s descendants with explicit coverage;
its local positions are read-only. Action responses separate delivery from UI
verification and include structured recovery strategies. phone_run_start with
trace=true enables a bounded, redacted timeline, available through
phone_run_trace; it contains no typed values or screenshots. These native
checks and subtree reads require an updated runner. See the
agent reference.
Activity history never stores click geometry, input identifiers or keypad keys. Green feedback uses only the latest nonsensitive named target, bound to the live owner/privacy scope, erased after 1.5 seconds and excluded from history.