查看可用列表
bash
xcrun simctl list devices
我的返回值如下:
bash
xcrun simctl list devices
== Devices ==
-- iOS 26.3 --
iPhone 17 Pro (39213084-ADA5-4738-AAAC-9EEAC6AB330F) (Shutdown)
iPhone 17 Pro Max (FF2BA69B-25D1-4B81-AD14-025950213AD2) (Shutdown)
iPhone Air (A4DBF801-55F0-4F50-875A-E6D45385278C) (Shutdown)
iPhone 17 (6F5C8C2A-2630-4661-A559-F7811CB18B73) (Shutdown)
iPhone 16e (FCC15529-D683-4B49-83D8-9E9C1BF6E52C) (Shutdown)
iPhone 15 Plus (1E06B612-2AE3-43D6-B010-CE4FD9094163) (Shutdown)
iPad Pro 13-inch (M5) (09D8C1CA-6F48-406B-9956-F75E870829C2) (Shutdown)
iPad Pro 11-inch (M5) (72A10B87-C5E7-438E-B3F4-7340687AC3DA) (Shutdown)
iPad mini (A17 Pro) (890171E5-EB74-43D1-93AD-409545483A3F) (Shutdown)
iPad (A16) (00BCD1F2-7A50-41BE-896E-31CE423876B8) (Shutdown)
iPad Air 13-inch (M3) (3146CA29-F726-4289-A8E1-9AB883E95489) (Shutdown)
iPad Air 11-inch (M3) (C60D6640-5682-4A43-856C-4B2117920E67) (Shutdown)
启动指定模拟器(推荐方式)
先找到设备的 UDID,然后:
bash
# 启动 Simulator 应用并打开指定设备
xcrun simctl boot "iPhone 17 Pro"
# 打开 Simulator 窗口(boot 后模拟器在后台,需要这步才显示界面)
open -a Simulator
常用配套命令
bash
# 查看所有设备(含状态)
xcrun simctl list devices
# 关闭所有正在运行的模拟器
xcrun simctl shutdown all
# 安装 .app 到模拟器
xcrun simctl install booted /path/to/YourApp.app
# 启动 app
xcrun simctl launch booted com.yourcompany.appname
# 截图
xcrun simctl io booted screenshot ~/Desktop/screen.png