pymobiledevice3-iphone

Low-level iPhone automation skill that controls an iPhone directly over USB without screen casting, OCR, or mouse emulation. Supports screenshots, HID hardware key events, clipboard read/write, app management, file system access, location simulation, and SpringBoard control. Prerequisite: iPhone connected via USB and in developer mode.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "pymobiledevice3-iphone" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-246337b619316c9fec773d616967b723ae46fc0fbb636662cebca84fbc2531bc. Verify the upstream source and version against https://skillhub.cn/skills/user_d8831e99/pymobiledevice3-iphone before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Low-level iPhone automation skill that controls an iPhone directly over USB without screen casting, OCR, or mouse emulation. Supports screenshots, HID hardware key events, clipboard read/write, app management, file system access, location simulation, and SpringBoard control. Prerequisite: iPhone connected via USB and in developer mode.

0 Downloads

Introduction source: third_party · user_d8831e99 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
```bash
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: pymobiledevice3-iphone
slug: pymobiledevice3-iphone
displayName: iPhone底层自动化
description: "iPhone底层自动化技能 — 通过USB协议直接操控iPhone,无需投屏/OCR/鼠标模拟。支持截图、HID硬件按键、剪贴板读写、应用管理、文件系统访问、位置模拟、SpringBoard控制。当用户需要iPhone自动化操作时使用。前提:iPhone USB连接+开发者模式。"
description_zh: iPhone 底层自动化技能 — 通过 USB 协议直接控制 iPhone(pymobiledevice3),支持截图、按键、剪贴板、应用管理、文件访问、位置模拟。当需要操控 iPhone 时优先使用本技能,代替旧的 QuickTime 投屏方案。
version: 1.0.0
author: AtomCode
tags: [iPhone, 自动化, pymobiledevice3]

pymobiledevice3 iPhone 底层自动化

优先级:P0(已验证全通,立即可用) 适用智能体:Claude Code / Hermes / 任何有 Python 环境的智能体 前提:iPhone USB 连接 + 开发者模式(一次性配置) 验证设备:iPhone 16 Pro (iPhone18,1), iOS 26.5.1, macOS 26, pymobiledevice3 9.33.1


🆚 与旧方案(QuickTime 投屏)的差异

维度 旧方案 (011) 新方案 (本技能)
连接方式 投屏画面 → OCR/鼠标点击 USB 协议直接通信
截图 QuickTime 窗口截图 core-device screen-capture 像素级原图
触控 鼠标模拟点击(不可靠) HID 协议底层注入(精确到像素)
剪贴板 ❌ 不支持 ✅ 直接读写
应用控制 需要先看到图标再点击 ✅ 指定 bundle ID 直接启动/杀死
可靠性 依赖窗口位置、分辨率、OCR精度 ✅ 协议级操作,无精度损失

旧文档(011)仍可用作回退,但推荐优先使用本方案。


一、环境(已就绪,无需重新安装)

# venv 路径
~/.pymobiledevice3-venv/bin/pymobiledevice3

# 或 source 后直接用
source ~/.pymobiledevice3-venv/bin/activate
pymobiledevice3 <子命令>

已安装版本:pymobiledevice3 9.33.1,Python 3.14,安装大小约 ~300MB。


二、iPhone 前置条件(用户侧一次性操作)

2.1 硬件

  • iPhone 用 USB 数据线 连接 Mac
  • 解锁 iPhone(必须解锁状态)

2.2 开发者模式

iPhone 操作:设置 → 隐私与安全性 → 底部「开发者模式」→ 打开 → 重启 → 输密码解锁 → 弹出确认框点「打开」。

验证:

~/.pymobiledevice3-venv/bin/pymobiledevice3 amfi developer-mode-status
# 返回 true 即已开启

2.3 信任配对

~/.pymobiledevice3-venv/bin/pymobiledevice3 lockdown pair

iPhone 弹出「信任此电脑?」→ 点「信任」。

2.4 挂载开发者镜像(每次重新插拔后需要)

~/.pymobiledevice3-venv/bin/pymobiledevice3 mounter auto-mount

三、核心能力速查

关键规则:iOS 17+ 所有 developer 命令必须加 --userspace。

3.1 设备检测

pymobiledevice3 usbmux list

3.2 设备信息

pymobiledevice3 lockdown info

3.3 应用管理

pymobiledevice3 apps list                                              # 列出所有应用
pymobiledevice3 developer core-device launch-application <bundle_id> --userspace ''  # 启动
pymobiledevice3 developer dvt proclist --userspace                     # 运行中进程
pymobiledevice3 developer dvt kill <pid> --userspace                   # 杀死进程
pymobiledevice3 developer dvt pkill WeChat --userspace                 # 按名杀进程

常用 bundle ID:

应用 bundle ID
微信 com.tencent.xin
企业微信 com.tencent.ww
飞书 com.bytedance.ee.lark
抖音 com.ss.iphone.ugc.Aweme
DeepSeek com.deepseek.chat
Safari com.apple.mobilesafari
设置 com.apple.Preferences

3.4 截图(像素级原图,~5MB PNG)

pymobiledevice3 developer core-device screen-capture screenshot /path/to/output.png --userspace
# iPhone 16 Pro 分辨率约 1206×2622

3.5 剪贴板读写

pymobiledevice3 developer core-device paste --userspace                # 读取 iPhone 剪贴板
echo "内容" | pymobiledevice3 developer core-device copy --userspace   # Mac → iPhone 剪贴板

3.6 HID 硬件按键

# 支持:home, power, volume-up, volume-down, lock
pymobiledevice3 developer core-device hid button home --userspace
pymobiledevice3 developer core-device hid button power down --userspace  # 仅按下
pymobiledevice3 developer core-device hid button power up --userspace    # 仅抬起

3.7 文件系统(AFC)

pymobiledevice3 afc ls /                  # 根目录
pymobiledevice3 afc ls /DCIM              # 相册照片
pymobiledevice3 afc pull /DCIM/100APPLE/IMG_0001.JPG ~/Desktop/   # 下载文件
pymobiledevice3 afc push ~/Desktop/file.txt /Downloads/           # 上传文件

AFC 路径对应:/DCIM 相机照片、/Downloads Safari 下载、/Books Apple Books。

3.8 位置模拟

pymobiledevice3 developer dvt simulate-location set <lat> <lng> --userspace
pymobiledevice3 developer dvt simulate-location clear --userspace

3.9 SpringBoard

pymobiledevice3 springboard state get                  # 桌面图标布局
pymobiledevice3 springboard icon com.tencent.xin ~/wechat_icon.png  # 提取应用图标

3.10 HID 触控注入(⚠️ 待深入验证)

pymobiledevice3 developer core-device hid raw-button --help
pymobiledevice3 developer core-device universal-hid-service --help

多点触控坐标协议 API 已就绪,具体坐标注入待深入测试。

3.11 WebDriverAgent 高级 UI(⚠️ 需安装 WDA)

pymobiledevice3 developer wda status --userspace        # 检查 WDA 状态
pymobiledevice3 developer wda tap "微信" --userspace    # 点击元素
pymobiledevice3 developer wda swipe 200 500 200 200 --userspace  # 滑动
pymobiledevice3 developer wda type "你好" --userspace   # 输入文本

四、故障排查

错误 原因 解决
passcode is set 开发者模式需手动开启 iPhone上手动操作:设置 → 隐私 → 开发者模式
Unable to connect to Tunneld iOS 17+ 隧道方式 加 --userspace 参数
Failed to start service 镜像未挂载 先 amfi developer-mode-status 确认,再 mounter auto-mount,不行就重新插拔 USB
设备列表为空 USB 未识别 重新插拔、解锁 iPhone、system_profiler SPUSBDataType 确认
externally-managed-environment PEP 668 必须用 venv,不要用系统 pip3

五、完整工作流示例

示例1:截图 + 剪贴板循环

#!/bin/bash
source ~/.pymobiledevice3-venv/bin/activate
pymobiledevice3 mounter auto-mount 2>&1 | grep -q "mounted" || { echo "挂载失败"; exit 1; }
pymobiledevice3 developer core-device screen-capture screenshot ~/screenshot_$(date +%H%M%S).png --userspace
echo "--- 剪贴板 ---"
pymobiledevice3 developer core-device paste --userspace
echo "自动化时间: $(date)" | pymobiledevice3 developer core-device copy --userspace

示例2:打开微信 + 截图确认

#!/bin/bash
source ~/.pymobiledevice3-venv/bin/activate
pymobiledevice3 developer core-device launch-application com.tencent.xin --userspace ''
sleep 3
pymobiledevice3 developer core-device screen-capture screenshot ~/wechat_opened.png --userspace

示例3:批量导出应用列表

#!/bin/bash
source ~/.pymobiledevice3-venv/bin/activate
pymobiledevice3 apps list | python3 -c "
import sys, json
apps = json.load(sys.stdin)
for k, v in sorted(apps.items(), key=lambda x: x[1].get('CFBundleDisplayName','').lower()):
    name = v.get('CFBundleDisplayName', '?')
    version = v.get('CFBundleShortVersionString', '?')
    print(f'{name:<20s} {version:<10s} {k}')
" > ~/iphone_apps.txt

六、跨智能体协作

能力栈位置

业务逻辑层(微信操作/加好友/发消息)    ← 其他智能体编写
pymobiledevice3 底层通道              ← 本技能提供
Python venv + USB + 开发者模式        ← 本技能 一/二

其他智能体调用规则

  1. 所有 developer 命令前确保已执行 mounter auto-mount
  2. iOS 17+ 命令必须带 --userspace
  3. iPhone 必须 USB 连接 + 解锁状态
  4. 命令路径使用完整路径:~/.pymobiledevice3-venv/bin/pymobiledevice3

何时使用本技能 vs 旧方案

  • 需要精确操作(截图/剪贴板/按键/文件)→ 本技能
  • 需要高级 UI 操作(tap/swipe/type)→ 优先本技能 WDA(若已安装),否则回退旧方案
  • 只需要看画面/不需要精确控制 → 旧方案仍可用

七、验证记录

日期 环境 结果
2026-07-11 iPhone 16 Pro, iOS 26.5.1, macOS 26 ✅ 全部通过

已验证:设备检测、设备信息、信任配对、开发者模式、镜像挂载、应用列表、启动应用、截图、读剪贴板、写剪贴板、硬件按键、备选截图。

未验证:WDA(需安装 WebDriverAgent)、多点触控坐标协议(待深入测试)。


📂 相关文件

  • 旧方案:~/_学习池/011_iPhone投屏自动化操作_规格.md(QuickTime 投屏)
  • 详细参考文档:~/Desktop/学习池/012_pymobiledevice3_iPhone底层自动化.md
  • 官方仓库:https://github.com/doronz88/pymobiledevice3
  • venv 路径:~/.pymobiledevice3-venv/
  • 设备配对文件:~/.pymobiledevice3/

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 提供 iPhone 底层自动化能力,通过 USB 协议直接操控设备,无需投屏/OCR/鼠标模拟
  • 支持截图、HID 硬件按键、剪贴板读写、应用管理、文件系统访问、位置模拟、SpringBoard 控制等核心功能
  • 解决用户明确的自动化痛点,显著提升日常高频场景的效率
Trigger Precision95/100

Highlights

  • description 明确描述使用场景(iPhone 自动化操作)和前提条件(USB 连接+开发者模式)
  • 触发词覆盖完整,边界清晰,用户能准确判断何时使用该 Skill
Structure and Standards95/100

Highlights

  • 文档结构完整,包含环境准备、前置条件、核心能力速查、故障排查、完整工作流示例、跨智能体协作说明
  • 步骤清晰,有出口条件和端到端示例,frontmatter 完整,便于用户理解和执行
Execution Reliability95/100

Highlights

  • 工具来源明确(pymobiledevice3),参数正确,覆盖主要异常(如挂载失败、设备未识别等)
  • 提供详细的故障排查表,不可逆操作有确认机制,确保执行过程可靠
Evidence Verifiability (mean of the first four)95/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

```bash

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.