📱

iOS Simulator で Unable to boot the Simulator とエラーが出た時の対処方法

に公開

これなに

iOS シミュレーターを起動しようと思ったらこのメッセージが出てきてなにも起動できなかったので、その時の試行内容と解決方法をメモ。
image.png

解決方法

キャッシュ以下すべてを削除して復活しました。

rm -rf ~/Library/Developer/CoreSimulator/Caches/*

エラーログ

cat ~/Library/Logs/CoreSimulator/CoreSimulator.log して調べてみると以下のようなエラーが吐かれていた。

Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding から察するに、なんかクラッシュしとるらしいとのこと。知らんけど。

Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Unable to boot simulator session com.apple.CoreSimulator.SimDevice.DA5009B0-DB8A-4FE0-BB46-EC63E908D72C (isTimeout = YES): Error Domain=com.apple.SimLaunchHostService.RequestError Code=4 "Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding" UserInfo={NSLocalizedDescription=Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSUnderlyingError=0x600001cdf540 {Error Domain=com.apple.SimLaunchHostService.RequestError Code=4 "Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding" UserInfo={NSLocalizedDescription=Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding}}, NSLocalizedDescription=Unable to boot the Simulator., Session=com.apple.CoreSimulator.SimDevice.DA5009B0-DB8A-4FE0-BB46-EC63E908D72C, NSLocalizedFailureReason=launchd failed to respond.}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSUnderlyingError=0x600001cdf540 {Error Domain=com.apple.SimLaunchHostService.RequestError Code=4 "Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding" UserInfo={NSLocalizedDescription=Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding}}, NSLocalizedDescription=Unable to boot the Simulator., Session=com.apple.CoreSimulator.SimDevice.DA5009B0-DB8A-4FE0-BB46-EC63E908D72C, NSLocalizedFailureReason=launchd failed to respond.}
Apr 28 09:25:17 su3-hokkaido com.apple.iphonesimulator[2406] <Error>: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSUnderlyingError=0x6000036f54a0 {Error Domain=com.apple.SimLaunchHostService.RequestError Code=4 "Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding" UserInfo={NSLocalizedDescription=Failed to start launchd_sim: could not bind to session, launchd_sim may have crashed or quit responding}}, NSLocalizedDescription=Unable to boot the Simulator., Session=com.apple.CoreSimulator.SimDevice.DA5009B0-DB8A-4FE0-BB46-EC63E908D72C, NSLocalizedFailureReason=launchd failed to respond.}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error looking up host support port: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error looking up host support port: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}
Apr 28 09:25:17 su3-hokkaido CoreSimulatorService[1434] <Error>: Error Domain=com.apple.CoreSimulator.SimError Code=405 "Unable to lookup in current state: Shutdown" UserInfo={NSLocalizedDescription=Unable to lookup in current state: Shutdown}

試したけどダメだったもの

とりあえずキャッシュ削除してみた

rm -rf ~/Library/Caches/com.apple.dt.Xcode/ でキャッシュ削除してみたら枠だけ出てきて同じくエラーに。
image.png

新しいエミュレーター作成してみた

同じエラーになった、やはり Simulator 自体に問題がありそう。
image.png

DerivedData 削除

中間ファイルを削除してみたけれども、これもダメだった。

rm -rf ~/Library/Developer/Xcode/DerivedData/

最後に

まあエミュレーターなんてぶっ壊して OK でしょうの精神でやってましたが、なにが原因だったんだろうか。気になる。。。

GitHubで編集を提案

Discussion