@jinglian: 卧槽,Codex 可以使用你的 iPhone! 介绍一下:phone-harness > 像人类一样自动化任何 iOS 应用 > 原生 iPhone 控制 → 无需 API,无需越狱 > 连接一次,随时控制 只需一个提示即可设置。 立即开…
摘要
介绍 phone-harness,一个开源工具,通过 macOS 的 iPhone Mirroring 让 LLM(如 Codex)像人类一样自动化任意 iOS 应用,无需 API 或越狱,利用屏幕截图、Vision OCR 和 HID 事件实现视觉与操作。
查看缓存全文
缓存时间: 2026/08/11 05:42
卧槽,Codex 可以使用你的 iPhone!
介绍一下:phone-harness
像人类一样自动化任何 iOS 应用 原生 iPhone 控制 → 无需 API,无需越狱 连接一次,随时控制
只需一个提示即可设置。 立即开搞 https://github.com/ShawnPana/phone-harness…
这个和 @airtap_ai 相比,只能本地运行。
Airtap 是直接给 AI Agent 配了一台长期在线、已经登录各种 App 的安卓手机,可以随时随地执行“手机自动化”。 Airtap更好玩
https://airtap.ai
ShawnPana/phone-harness
Source: https://github.com/ShawnPana/phone-harness
Phone Harness 📱
Connect an LLM directly to your real iPhone with a thin, editable harness. No jailbreak, no Xcode, no WebDriverAgent.
The Mac’s iPhone Mirroring window is the whole transport: screencapture +
Vision-framework OCR for eyes, HID-level CGEvents for hands. Nothing between the
agent and the phone. The agent writes what’s missing during execution in
agent-workspace/agent_helpers.py.
● agent: wants to open Weather
│
● ocr() → "Weather" at (400, 468)
│
● tap(400, 468) → wait_stable() → ocr() confirms the forecast
✓ done
Your phone, driven by an agent.
Setup prompt
Paste into Claude Code or Codex:
Set up phone-harness for me. Clone https://github.com/ShawnPana/phone-harness
into ~/.phone-harness (its canonical home) and read `install.md` first to install
it and connect it to my real iPhone
through the macOS iPhone Mirroring app — install it so `phone-harness` is a
command on my PATH, and register it as an agent skill named phone-harness using
`phone-harness skill` as the body, so you reach for it automatically. Then read
`SKILL.md` for normal usage, and always read `src/phone_harness/helpers.py`
because that is where the functions are. Whenever you capture or verify the
screen, activate the iPhone Mirroring window so I can see what you're doing on
the phone.
Setup needs two things only I can do: pairing iPhone Mirroring with my phone
once, and granting the terminal Accessibility + Screen Recording in System
Settings — walk me through those and wait for me. Verify with
`./phone-harness --doctor`.
After it's installed, as a quick demo that interaction works, go to my Home
Screen and — if the phone is connected and unlocked — ask me whether you should
open the Weather app as a harmless test; only open it if I say yes. If the
session is paused or the phone is locked, just tell me the doctor status instead.
The agent will walk you through the two things only you can do: pairing
iPhone Mirroring with your phone once (the pairing prompts need the physical
phone), and granting the terminal Accessibility (taps & keystrokes) and
Screen Recording (seeing the phone) in System Settings → Privacy &
Security. Screen Recording takes effect after the terminal restarts;
Accessibility is immediate. Then ./phone-harness --doctor verifies the whole
chain.
These are the permissions currently known to be required. A fresh machine may
prompt for more the first time an action runs — if --doctor passes but taps or
capture silently do nothing, watch for a macOS permission prompt. See
install.md for details.
Why this works
iPhone Mirroring (macOS Sequoia+) renders the phone as a Mac window and forwards real mouse and keyboard input as touches. That gives an agent everything it needs:
- See — capture just the mirroring window, OCR it with Apple’s Vision framework: every visible string with a tap-ready coordinate. The poor man’s DOM.
- Act — CGEvents posted at the HID tap: taps, long-presses, drags/flicks, scroll gestures, unicode typing, and the app’s own shortcuts (Cmd+1 Home, Cmd+2 App Switcher, Cmd+3 Spotlight).
- Verify — screenshot again. No DOM means the capture is the ground truth.
Things that do NOT work, learned the hard way: AppleScript click at (silently
ignored — the window is a video stream with no accessibility tree), unicode key
payloads (mirroring forwards raw HID keycodes, so typing must use keycodes), a
slow touch-drag (barely moves an iOS list — use wheel scroll for lists, a fast
flick for pages), and input while the window isn’t frontmost (swallowed).
Usage
./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
Day-to-day workflow lives in SKILL.md, which install.md
registers as an agent skill (phone-harness skill prints the body) so the agent
reaches for it on its own.
Architecture
SKILL.md— day-to-day usage (the agent-facing product surface)install.md— permissions bootstrap and troubleshootingsrc/phone_harness/— protected core (~500 lines):mirror.py— window discovery, focus, capture, CGEvent inputocr.py— Vision-framework text recognition → screen-point boxeshelpers.py— the primitives pre-imported into scriptsadmin.py—--doctorrun.py— the CLI (execstdin with helpers in scope)
agent-workspace/agent_helpers.py— helper code the agent edits; auto-loaded into every script’s namespace
The mirror transport is stateless (window bounds and captures are re-queried per call), so there is no daemon — every invocation is self-contained.
Development
From a checkout, use ./phone-harness to run the working tree directly:
./phone-harness <<'PY'
print(screen_info())
PY
Limits
- One phone, one session; unlocking the physical phone pauses mirroring.
- No multi-touch (no pinch), no camera/Face ID flows, DRM video renders black.
- OCR sees text, not semantics — unlabeled icons need a screenshot + a vision-capable model.
前端哥Liam (@jinglian): 你有没有过这种经历:想薅各种各样的会员VIP首月优惠,但是忘记关闭自动续费,反被扣了连续包月的第二个月高价会员费。
微信读书、QQ音乐、各种会员突然扣了钱,点进去才发现“自动续费”开着,想关的时候,进到微信里面,要跳好几层页面,操作路径总是记不住,烦到想摔手机。
相似文章
@chyni: Codex现在开发iOS app 真是太香了。 Product Design + 内置浏览器做原型 iOS App Build 做开发,结合内置的模拟器预览功能 现在都不需要打开xcode了
Codex 现在可以直接用于开发 iOS 应用,整合了产品设计、内置浏览器原型和模拟器预览功能,无需打开 Xcode。
@Saccc_c: 发现了一个能让 DSH 也具备堪比Codex computer use能力的好工具 直接复制粘贴下面这个命令,给你的DSH等任意Agent装上手和眼睛: Install or upgrade macOS Harness from http…
macOS Harness 是一个开源工具,允许 AI 代理通过原始 macOS 原语在 Mac 上执行任务,具备类似 Codex computer use 的能力。
@xiangxiang103: 给大家实操一下Codex新功能Appshots:按下左右两个 Command 键,可以把当前最前面的 App 窗口截图和可读取文字一起发给 Codex,省得你手动截图、复制、描述。 目前我试了一下总结推特文章,非常好用,主要是快捷好多!以…
作者演示了Codex新功能Appshots,通过按下左右Command键即可截取当前应用窗口并发送给Codex,实现快速总结文章等操作,大幅提升效率。
@blakesamic: 本周末在外使用ChapGPT移动应用操控Codex。它正在控制Mac Mini上的Codex,后者正在……
一位用户演示了通过ChatGPT移动应用使用OpenAI的Codex来控制一台正在构建iPhone应用的Mac Mini,并通过TestFlight接收更新。
@qloog: 别再说 AI 只是提效工具了。 这套OpenAI 官方都认可的 Codex 教程,直接让你一个人干完一个团队的活: 做 iOS App、写代码、出投资者 Deck,全流程打通。 核心就两件事: 自定义 Skill(能力复用) 自动化(效率…
OpenAI-endorsed Codex tutorial enables solo developers to build iOS apps, write code, and generate investor decks through reusable custom skills and automation.