👻

iOS Simulatorが突然「Unable to boot the iOS simulator」と吐き起動しなくなった

2022/07/09に公開約4,500字

概要

モバイルアプリ開発のスーパー初学者です。
久しぶりにモバイルの勉強をしようとiOS Simulatorを起動しようとしたところ、「Unable to boot the iOS simulator」という警告を吐き起動しなくなってしまいました。
何番煎じかは分からない&iOSモバイルアプリ開発およびツールには知見がないため正しい情報ではない可能性もありますが、一つのケースとして記事に残しておきます。
(もし以降の内容を実際に試される場合は自己責任でお願いいたします🙇)

結論

CoreSimulatorのキャッシュを削除することで動作するようになりました。

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

参考: https://medium.com/@liwp.stephen/my-solution-to-solve-unable-to-boot-the-ios-simulator-39bbb4aad100

実際に出ていたログ

~/Library/Logs/CoreSimulator/CoreSimulator.log
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <Error>: Unable to boot simulator session com.apple.CoreSimulator.SimDevice.8C398528-5A4D-4289-BE7B-F4ABF5E79AC4 (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}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <Error>: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSLocalizedFailureReason=launchd failed to respond., NSLocalizedDescription=Unable to boot the Simulator., NSUnderlyingError=0x600003872940 {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}}}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <Error>: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSLocalizedFailureReason=launchd failed to respond., NSLocalizedDescription=Unable to boot the Simulator., NSUnderlyingError=0x600003872940 {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}}}
Jul  9 17:00:57 Mac com.apple.iphonesimulator[18925] <Error>: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSUnderlyingError=0x600002037000 {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}}, NSLocalizedFailureReason=launchd failed to respond., NSLocalizedDescription=Unable to boot the Simulator.}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <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}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <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}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <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}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <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}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <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}
Jul  9 17:00:57 Mac CoreSimulatorService[18156] <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}

試したこと

以下は試したが効果はありませんでした。

  • OS再起動
    • 短絡的に「OS再起動したら直るやろ(鼻ほじ)」と試したが直らず、急に血の気が引いた
  • /private/tmpのパーミッション変更
    • Failed to start launchd_simとかログベースで調べると一番よく出てくる
    • 私の場合ls -ldで確認してもパーミッションは問題なさそうで、念の為chmod 1777 /private/tmpしたが特に効果なしだった
  • Xcodeの設定からDerivedDataの削除

もしログの内容から詳細な原因等わかる方いらっしゃったら、ぜひ教えていただきたいです...。
ひとまず起動するようになってよかった...。

Discussion

ログインするとコメントできます