ios-device-screenshot by 0xbigboss/claude-code
npx skills add https://github.com/0xbigboss/claude-code --skill ios-device-screenshot使用 pymobiledevice3 通过 USB 连接物理 iOS 设备进行截图。
# 使用 uv 安装 pymobiledevice3(推荐)
uv tool install pymobiledevice3
# 或使用 pipx
pipx install pymobiledevice3
iOS 17+ 需要以 root 权限运行 tunneld 守护进程:
# 终端 1:启动 tunneld(需要 sudo,持续运行)
sudo pymobiledevice3 remote tunneld
# 终端 2:通过 DVT(开发者工具)截图
pymobiledevice3 developer dvt screenshot --tunnel "" /path/to/screenshot.png
--tunnel "" 标志告诉它使用 tunneld 进行设备通信。
pymobiledevice3 developer screenshot /path/to/screenshot.png
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 列出已连接的设备
xcrun devicectl list devices
# 检查 iOS 版本
ideviceinfo -k ProductVersion
# 检查开发者镜像是否已挂载
ideviceimagemounter list
# 如果需要,自动挂载开发者镜像
pymobiledevice3 mounter auto-mount --tunnel ""
# 截图(iOS 17+)- 单设备
pymobiledevice3 developer dvt screenshot --tunnel "" ~/Desktop/screenshot.png
# 使用特定设备 UDID 截图(多设备时必需)
# 首先从以下命令获取 UDID:xcrun devicectl list devices
# 将 UDID 直接传递给 --tunnel(不要使用 --udid 标志,该标志与 tunneld 不兼容)
pymobiledevice3 developer dvt screenshot --tunnel "00008101-001E05A41144001E" ~/Desktop/screenshot.png
重要提示: 当连接多个设备时,将 UDID 直接传递给 --tunnel(而不是 --udid)。--tunnel "" 语法会提示交互式选择,这在非交互式 shell 中会失败。
ps aux | grep tunneldsudo pymobiledevice3 remote tunnelddeveloper dvt screenshot 而不是 developer screenshotpymobiledevice3 mounter auto-mount --tunnel ""
使用 --udid 指定目标设备:
# 首先列出设备
xcrun devicectl list devices
# 使用特定的 UDID
pymobiledevice3 developer dvt screenshot --tunnel "" --udid "40182233-00C8-51ED-8C68-174E14E4B4C9" /tmp/screenshot.png
对于 iOS 17+,即使 tunneld 正在运行,常规的 pymobiledevice3 developer screenshot 命令也经常失败。解决方案是使用 DVT(开发者工具)变体:
# 这在 iOS 17+ 上会失败:
pymobiledevice3 developer screenshot --tunnel "" /tmp/screenshot.png
# 这在 iOS 17+ 上有效:
pymobiledevice3 developer dvt screenshot --tunnel "" /tmp/screenshot.png
#!/bin/bash
# 拍摄 iOS 设备截图并打开
OUTPUT="/tmp/ios-screenshot-$(date +%Y%m%d-%H%M%S).png"
# 检查 tunneld 是否在运行,如果没有则启动
if ! pgrep -f "pymobiledevice3 remote tunneld" > /dev/null; then
echo "正在启动 tunneld(需要 sudo)..."
sudo pymobiledevice3 remote tunneld &
sleep 3
fi
# 截图
pymobiledevice3 developer dvt screenshot --tunnel "" "$OUTPUT"
if [ -f "$OUTPUT" ]; then
echo "截图已保存至:$OUTPUT"
open "$OUTPUT" # macOS:在预览中打开
else
echo "截图捕获失败"
exit 1
fi
每周安装量
95
代码仓库
GitHub 星标数
37
首次出现
2026年1月21日
安全审计
已安装于
claude-code81
codex77
gemini-cli76
opencode76
cursor70
github-copilot66
Take screenshots from physical iOS devices connected via USB using pymobiledevice3.
# Install pymobiledevice3 using uv (recommended)
uv tool install pymobiledevice3
# Or with pipx
pipx install pymobiledevice3
iOS 17+ requires a tunneld daemon running with root privileges:
# Terminal 1: Start tunneld (requires sudo, runs continuously)
sudo pymobiledevice3 remote tunneld
# Terminal 2: Take screenshot via DVT (Developer Tools)
pymobiledevice3 developer dvt screenshot --tunnel "" /path/to/screenshot.png
The --tunnel "" flag tells it to use the tunneld for device communication.
pymobiledevice3 developer screenshot /path/to/screenshot.png
# List connected devices
xcrun devicectl list devices
# Check iOS version
ideviceinfo -k ProductVersion
# Check if developer image is mounted
ideviceimagemounter list
# Auto-mount developer image if needed
pymobiledevice3 mounter auto-mount --tunnel ""
# Take screenshot (iOS 17+) - single device
pymobiledevice3 developer dvt screenshot --tunnel "" ~/Desktop/screenshot.png
# Take screenshot with specific device UDID (required for multiple devices)
# First get UDIDs from: xcrun devicectl list devices
# Pass UDID directly to --tunnel (NOT --udid flag which doesn't work with tunneld)
pymobiledevice3 developer dvt screenshot --tunnel "00008101-001E05A41144001E" ~/Desktop/screenshot.png
Important: When multiple devices are connected, pass the UDID directly to --tunnel (not --udid). The --tunnel "" syntax prompts for interactive selection which fails in non-interactive shells.
ps aux | grep tunneldsudo pymobiledevice3 remote tunnelddeveloper dvt screenshot instead of developer screenshotpymobiledevice3 mounter auto-mount --tunnel ""
Specify the target device with --udid:
# List devices first
xcrun devicectl list devices
# Use specific UDID
pymobiledevice3 developer dvt screenshot --tunnel "" --udid "40182233-00C8-51ED-8C68-174E14E4B4C9" /tmp/screenshot.png
For iOS 17+, the regular pymobiledevice3 developer screenshot command often fails even with tunneld running. The solution is to use the DVT (Developer Tools) variant:
# This fails on iOS 17+:
pymobiledevice3 developer screenshot --tunnel "" /tmp/screenshot.png
# This works on iOS 17+:
pymobiledevice3 developer dvt screenshot --tunnel "" /tmp/screenshot.png
#!/bin/bash
# Take iOS device screenshot and open it
OUTPUT="/tmp/ios-screenshot-$(date +%Y%m%d-%H%M%S).png"
# Check if tunneld is running, start if not
if ! pgrep -f "pymobiledevice3 remote tunneld" > /dev/null; then
echo "Starting tunneld (requires sudo)..."
sudo pymobiledevice3 remote tunneld &
sleep 3
fi
# Take screenshot
pymobiledevice3 developer dvt screenshot --tunnel "" "$OUTPUT"
if [ -f "$OUTPUT" ]; then
echo "Screenshot saved to: $OUTPUT"
open "$OUTPUT" # macOS: open in Preview
else
echo "Failed to capture screenshot"
exit 1
fi
Weekly Installs
95
Repository
GitHub Stars
37
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
claude-code81
codex77
gemini-cli76
opencode76
cursor70
github-copilot66
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
44,900 周安装