DEBUG.WIKI
PanstarCloud:部署应用,接入 AI,云服务器与 AI 网关
晚安云;香港 CN2 ¥15/月
V.PS:让项目靠近用户,亚太、欧洲、北美 KVM VPS

解决 iOS 模拟器报错 Unable to boot the Simulator 启动挂死修复

排查 macOS 启动 iOS 模拟器提示 Unable to boot the Simulator in current state: Booting 错误,通过 killall 与 simctl 恢复状态。

问题现象

在 Xcode 或终端启动指定机型模拟器时弹窗报错:

Unable to boot the Simulator in current state: Booting
An error was encountered while processing the request 
(domain=com.apple.CoreSimulator.CoreSimulatorService, code=405).

模拟器界面长时间处于黑屏或 Apple 图标进度条静止状态。

触发根因

后台常驻的 com.apple.CoreSimulator.CoreSimulatorService 服务在系统睡眠唤醒、磁盘满载或宿主机强制重启时,其内部维护的状态机未完成清理,导致特定 UDID 的模拟器在数据字典中被永久标记为正在开机(Booting)而无法重新发送唤醒指令。

解决步骤

1. 强制终止 CoreSimulatorService 守护进程

在终端中杀死卡死的后台系统服务(launchd 会在需要时自动拉起新干净实例):

killall -9 com.apple.CoreSimulator.CoreSimulatorService
killall Simulator

2. 使用 xcrun simctl 强制关闭并清理异常设备

运行系统自带的模拟器调试工具注销所有挂死状态:

# 强制关机所有运行中的模拟器
xcrun simctl shutdown all

# 抹掉异常设备的缓存数据
xcrun simctl erase all

3. 命令行验证冷启动

选择目标设备执行冷启动:

xcrun simctl boot "iPhone 15"
open -a Simulator

验证确认

查看当前运行中模拟器列表:

xcrun simctl list devices | grep "(Booted)"

控制台成功打印 iPhone 15 (...) (Booted),模拟器桌面流畅呈现。