ios-simulator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseiOS Simulator Automation
iOS Simulator自动化
This skill provides a Node-only CLI wrapper around:
- for simulator/device/app management
xcrun simctl - for accessibility-tree inspection + synthesised UI input (tap/text/button)
idb
It is designed for AI agents: minimal, structured output by default, with opt-in detail.
该Skill提供一个仅支持Node.js的CLI封装,基于以下工具:
- :用于模拟器/设备/应用管理
xcrun simctl - :用于无障碍树检查以及合成UI输入(点击/文本输入/按钮操作)
idb
它专为AI Agent设计:默认输出简洁结构化内容,可选择启用详细输出。
Important constraints
重要限制条件
- Must run on macOS with Xcode Command Line Tools (or Xcode) available.
- If the ClawdBot gateway is not macOS, run these commands on a connected macOS node (see “Remote macOS node” below).
- is optional, but required for UI tree / semantic tapping. (Install steps below.)
idb
- 必须运行在macOS系统上,且需安装Xcode Command Line Tools(或Xcode)。
- 如果ClawdBot网关不是macOS系统,请在连接的macOS节点上运行这些命令(详见下方“远程macOS节点”)。
- 为可选依赖,但如需进行UI树检查/语义化点击操作则必须安装。(安装步骤见下文。)
idb
Quick start
快速开始
bash
undefinedbash
undefined1) Sanity check
1) 完整性检查
node {baseDir}/scripts/ios-sim.mjs health
node {baseDir}/scripts/ios-sim.mjs health
2) List simulators (compact)
2) 列出模拟器(精简模式)
node {baseDir}/scripts/ios-sim.mjs list
node {baseDir}/scripts/ios-sim.mjs list
3) Select a default simulator (writes .ios-sim-state.json in the current dir)
3) 选择默认模拟器(在当前目录写入.ios-sim-state.json文件)
node {baseDir}/scripts/ios-sim.mjs select --name "iPhone" --runtime "iOS" --boot
node {baseDir}/scripts/ios-sim.mjs select --name "iPhone" --runtime "iOS" --boot
4) Install + launch an .app
4) 安装并启动.app应用
node {baseDir}/scripts/ios-sim.mjs app install --app path/to/MyApp.app
node {baseDir}/scripts/ios-sim.mjs app launch --bundle-id com.example.MyApp
node {baseDir}/scripts/ios-sim.mjs app install --app path/to/MyApp.app
node {baseDir}/scripts/ios-sim.mjs app launch --bundle-id com.example.MyApp
5) Inspect current UI (requires idb)
5) 检查当前UI(需要idb)
node {baseDir}/scripts/ios-sim.mjs ui summary
node {baseDir}/scripts/ios-sim.mjs ui tap --query "Log in"
node {baseDir}/scripts/ios-sim.mjs ui type --text "hello world"
node {baseDir}/scripts/ios-sim.mjs ui summary
node {baseDir}/scripts/ios-sim.mjs ui tap --query "Log in"
node {baseDir}/scripts/ios-sim.mjs ui type --text "hello world"
6) Screenshot
6) 截图
node {baseDir}/scripts/ios-sim.mjs screenshot --out artifacts/screen.png
undefinednode {baseDir}/scripts/ios-sim.mjs screenshot --out artifacts/screen.png
undefinedRemote macOS node
远程macOS节点
If you are not on macOS, run the same commands on the macOS node using ClawdBot’s node execution (e.g. with / node tools). Ensure the skill folder exists on that node, or copy it there.
exechost: node若你不在macOS系统上,可使用ClawdBot的节点执行功能(例如带/node工具的命令)在macOS节点上运行相同命令。确保该Skill文件夹已存在于该节点,或先将其复制过去。
host: nodeexecOutput conventions (token-efficient)
输出规范(高效利用Token)
- Default output: single-line JSON (small summary object).
- Add to pretty-print JSON.
--pretty - Add for a short human-readable summary (when provided by the command).
--text - Commands that can be huge (,
ui tree) are opt-in.list --full
- 默认输出:单行JSON(简洁的摘要对象)。
- 添加参数可格式化输出JSON。
--pretty - 添加参数可获取简短的人类可读摘要(仅部分命令支持)。
--text - 可能产生大量输出的命令(如、
ui tree)需主动启用。list --full
State / default UDID
状态/默认UDID
select./.ios-sim-state.json--udid <UUID>Override location with:
IOS_SIM_STATE_FILE=/path/to/state.json
select./.ios-sim-state.json--udid <UUID>可通过以下方式覆盖状态文件路径:
IOS_SIM_STATE_FILE=/path/to/state.json
Dependency notes
依赖说明
Xcode / simctl availability
Xcode / simctl可用性
If cannot find , ensure Xcode CLI tools are selected (via Xcode settings or ) and run the first-launch setup:
xcrunsimctlxcode-selectxcodebuild -runFirstLaunch
若无法找到,请确保已选择Xcode CLI工具(可通过Xcode设置或命令),并运行首次启动设置:
xcrunsimctlxcode-selectxcodebuild -runFirstLaunch
idb (for accessibility automation)
idb(用于无障碍自动化)
Install and the CLI:
idb_companionidbbash
brew tap facebook/fb
brew install idb-companion
python3 -m pip install --upgrade fb-idb安装和 CLI:
idb_companionidbbash
brew tap facebook/fb
brew install idb-companion
python3 -m pip install --upgrade fb-idbSafety tiers
安全等级
| Tier | Commands | Notes |
|---|---|---|
| SAFE | | No data loss |
| CAUTION | | Alters simulator/app state |
| DANGEROUS | | Requires |
| 等级 | 命令 | 说明 |
|---|---|---|
| 安全 | | 无数据丢失风险 |
| 注意 | | 会修改模拟器/应用状态 |
| 危险 | | 需要添加 |
Command index
命令索引
All commands live under:
bash
node {baseDir}/scripts/ios-sim.mjs <command> [subcommand] [flags]所有命令均使用以下格式:
bash
node {baseDir}/scripts/ios-sim.mjs <command> [subcommand] [flags]Core simulator lifecycle
核心模拟器生命周期管理
list [--full]select --name <substr> [--runtime <substr>] [--boot]boot [--udid <uuid>] [--wait]shutdown [--udid <uuid>|--all]erase --yes [--udid <uuid>|--all]delete --yes [--udid <uuid>]create --name <name> --device-type <substr> --runtime <substr>
list [--full]select --name <substr> [--runtime <substr>] [--boot]boot [--udid <uuid>] [--wait]shutdown [--udid <uuid>|--all]erase --yes [--udid <uuid>|--all]delete --yes [--udid <uuid>]create --name <name> --device-type <substr> --runtime <substr>
App management
应用管理
app install --app <path/to/App.app> [--udid ...]app uninstall --bundle-id <id> [--udid ...]app launch --bundle-id <id> [--udid ...] [-- <args...>]app terminate --bundle-id <id> [--udid ...]app container --bundle-id <id> [--type data|app] [--udid ...]
app install --app <path/to/App.app> [--udid ...]app uninstall --bundle-id <id> [--udid ...]app launch --bundle-id <id> [--udid ...] [-- <args...>]app terminate --bundle-id <id> [--udid ...]app container --bundle-id <id> [--type data|app] [--udid ...]
Screenshots & video
截图与录屏
screenshot --out <file.png> [--udid ...]- (runs until Ctrl+C)
record-video --out <file.mp4> [--udid ...]
screenshot --out <file.png> [--udid ...]- (按Ctrl+C停止)
record-video --out <file.mp4> [--udid ...]
Clipboard / URL
剪贴板/URL
clipboard get [--udid ...]clipboard set --text <text> [--udid ...]openurl --url <url> [--udid ...]
clipboard get [--udid ...]clipboard set --text <text> [--udid ...]openurl --url <url> [--udid ...]
Simulator permissions & push notifications
模拟器权限与推送通知
privacy grant --bundle-id <id> --service <svc[,svc...]> [--udid ...]privacy revoke --bundle-id <id> --service <svc[,svc...]> [--udid ...]privacy reset --bundle-id <id> --service <svc[,svc...]> [--udid ...]push --bundle-id <id> --payload <json-string> [--udid ...]
privacy grant --bundle-id <id> --service <svc[,svc...]> [--udid ...]privacy revoke --bundle-id <id> --service <svc[,svc...]> [--udid ...]privacy reset --bundle-id <id> --service <svc[,svc...]> [--udid ...]push --bundle-id <id> --payload <json-string> [--udid ...]
Logs
日志
logs show [--last 5m] [--predicate <expr>] [--udid ...]
logs show [--last 5m] [--predicate <expr>] [--udid ...]
Accessibility-driven UI automation (requires idb)
基于无障碍功能的UI自动化(需要idb)
ui summary [--limit 12]- (full UI JSON array)
ui tree ui find --query <text> [--limit 20]- (find + tap best match)
ui tap --query <text> - (raw coordinate tap)
ui tap --x <num> --y <num> ui type --text <text>ui button --name HOME|LOCK|SIRI|SIDE_BUTTON|APPLE_PAY
ui summary [--limit 12]- (完整UI JSON数组)
ui tree ui find --query <text> [--limit 20]- (查找并点击最佳匹配项)
ui tap --query <text> - (基于坐标的原始点击)
ui tap --x <num> --y <num> ui type --text <text>ui button --name HOME|LOCK|SIRI|SIDE_BUTTON|APPLE_PAY
Troubleshooting
故障排除
See: references/TROUBLESHOOTING.md
详见:references/TROUBLESHOOTING.md