My solution to solve Unable to boot the iOS simulator
Today, when I restart my computer, and I want to start the Simulator with the following command:
Today, when I restart my computer, and I want to start the Simulator with the following command:open -a Simulator
But it report Unable to boot the iOS simulator
error, this is the way I tried to solve the problem.
Investigate the log file
I find the error message from /Library/Logs/CoreSimulator/CoreSimulator.log
, but the message is not helpful, the message are like below:Jun 21 15:55:26 <ComputerName> CoreSimulatorService[994] <Error>: Could not register service com.apple.gputools.agent.producer.sim: Failed to lookup com.apple.gputools.agent.producer.sim: 0x44e
Jun 21 15:55:35 <ComputerName> CoreSimulatorService[994] <Error>: Unable to boot simulator session com.apple.CoreSimulator.SimDevice.FE3B6CB8-AA93-47B6-874F-8C59CBB563E3 (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}
Jun 21 15:55:35 <ComputerName> CoreSimulatorService[994] <Error>: Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo={NSLocalizedFailureReason=launchd failed to respond., NSLocalizedDescription=Unable to boot the Simulator., NSUnderlyingError=0x600000405fe0 {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}}}
Recreate Simulator from Xcode
Then I try to delete the Simulator from Xcode, and recreate a new Simulator, but the Simulator still can’t start.
Delete cache files
The last things is that I delete the large files, the files that I deleted are as below:~/Library/Caches
~/Library/Developer/CoreSimulator/Caches
~/Library/Developer/Xcode/iOS\ DeviceSupport/ # all subfolders except 15.5 (19F77) arm64e
~/Library/Developer/Xcode/DerivedData/
I delete these folders because the first two is the cache folder, the think the problem might caused by the cache files.
I delete all subfolders under ~/Library/Developer/Xcode/iOS\ DeviceSupport/
because I only test iOS 15.5, and every version is spend 3–5 GB spaces.
I deleted the contents inside ~/Library/Developer/Xcode/DerivedData/
because the content in this folder is the apps that we build, and they also spend a lot of space in my computer.
After delete these files, I create a new Simulator, and aha the Simulator started.