macOS通过命令行启动iOS模拟器

查看可用列表

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
相关推荐
冯汉栩18 小时前
Swift Control RollingCountdownView(动画倒计时)
开发语言·ios·swift
_瑞1 天前
读懂 iOS 的线程调用栈
ios·编译原理·汇编语言
末代iOS程序员华仔1 天前
iOS 语聊直播/聊天APP4.3条例被拒解决
flutter·ios·swift
Lucky09281 天前
codex 安装前置软件
linux·运维·macos
Zguigo2 天前
lesson24-26计算机网络第三章精讲:从MAC地址到CSMA/CD,数据链路层核心知识一网打尽
计算机网络·macos
EXI-小洲2 天前
MacOS 环境下 IntelliJ IDEA 的 Maven 配置指南
macos·maven·intellij-idea
2601_965798472 天前
Build a Fast, High-Ranking Restaurant Website with Rolanda Theme
开发语言·ios·swift
极客互动API2 天前
企业微信 iPad 协议消息接口开发:文本 / 图片 / 群发消息的统一封装
人工智能·ios·微信·机器人·企业微信·ipad
我血条子呢2 天前
iOS 软键盘遮挡底部输入框解决报告
ios
aspirant-complete2 天前
MAC(Apple Silicon)嵌入式基于Clion(stm32CubeMX)环境搭建
stm32·macos