问题描述
Mac OS 13.2,Xcode14在Run项目后,Build成功无法启动模拟器,提示如下:
Unable to boot the Simulator. Interrupted system call
在Xcode中的报错信息,展开如下:
Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit
对我无效的方案
1、完全卸载重装Xcode并重装
sudo rm -rf /Applications/Xcode.app
sudo rm -rf ~/Library/Developer/
sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode/
sudo rm -rf ~/Library/Application\ Support/Xcode/
sudo rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist
sudo rm -rf ~/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState/
sudo rm -rf /Library/Developer/
sudo rm -rf /Library/Caches/com.apple.dt.Xcode/
sudo rm -rf /Library/Application\ Support/Xcode/
sudo rm -rf /Library/Preferences/com.apple.dt.Xcode.plist
sudo rm -rf /Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState/
sudo rm -rf ~/.Trash/*
2、设置Xcode相关访问权限
sudo chown root:admin /tmp; sudo chmod 1777 /tmp
sudo chown root:wheel /private/tmp; sudo chmod 1777 /private/tmp
3、清理模拟器相关设置
3.1、通过设置->通用->存储空间->开发者
,点击开发者后面的按钮,删除弹窗中的内容
3.2、删除下面路径的文件
# 删除CoreSimulator文件
open ~/Library/Developer
# 删除DerivedData文件
open ~/Library/Developer/Xcode
4、删除已加载的模拟器,并重新添加
点击Xcode的状态栏中的Window->Devices and Simulators,选择Simulators,将展示的所有模拟器删除,然后重新添加
5、安装其他系统版本的模拟器
打开Xcode的设置,选择Platforms,点击左下角的
+
号,选择想要安装的系统版本
此方法我最终安装失败,提示Not compatible with X... ... The file "com.apple.dmg.iPhoneSimulatorSDK 16_2-16.2.0.0.dmg" doesn't exist
错误,如下图
最终解决方案
打开Mac OS的活动监视器,将Xcode停止掉,并搜索sim
,将搜索到模拟器相关的程序,也一起停止掉;
此时重启Xcode,Run项目,模拟器成功启动
参考文章
Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed:
文章一:苹果社区
xcode - When running on older iOS Simulator, error "Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding":
Stackoverflow