用 simctl 给 iOS 模拟器截图
在终端里把模拟器屏幕保存为全分辨率 PNG 图片。
运行 xcrun simctl io booted screenshot ~/Desktop/simulator.png 保存正在运行的模拟器画面。
01命令
命令
$ xcrun simctl io booted screenshot ~/Desktop/simulator.png02作用说明
simctl 的 io 子命令能按设备原始分辨率抓取模拟器画面,比截整屏再裁剪干净得多。'booted' 指当前正在运行的模拟器,也可以换成 xcrun simctl list devices 里查到的具体设备 UDID。它还有对应的 recordVideo 子命令可以录制模拟器视频。
03风险
!注意: 必须至少启动了一台模拟器,否则会报 'No devices are booted';截图直接保存、没有任何确认提示,注意检查输出路径。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- xcrun - run or locate developer tools依据: Documents xcrun as the launcher for Xcode developer tools such as simctl.
最后验证: 2026-09-18 · 分类: 开发者