6

I have recently been trying to use the newest version of Xcode (10.0), but when I go to open the simulator I get the error saying

"simulator unable to boot"

I have tried downloading previous versions but I still get the same error.

Screenshot for issue attached

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
Liam Ramsbottom
  • 157
  • 3
  • 15

1 Answers1

12

Your simulators might be stuck in some loop, try running this in bash:

The following lines delete all simulators

xcrun simctl shutdown all  
xcrun simctl delete $(xcrun simctl list | grep -o '[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}' | xargs)
xcrun simctl delete unavailable

Then you can install all the devices via xcrun simctl again or via xcode. Simply run this code in bash line by line once again:

# This takes latest runtime available in xcode build. (IT counts with beta...)
runtime=$(xcrun simctl list runtimes | grep "iOS" | tail -1 | awk -F' - ' '{print $3F}')

# Simulators should carry the iOS version. And probably CI Prefix.
# Check if simulators alreadz exists.
echo "The current iOS runtime is: $runtime"
xcrun simctl create "iPhone 7" com.apple.CoreSimulator.SimDeviceType.iPhone-7 $runtime
Dominik Bucher
  • 2,120
  • 2
  • 16
  • 25
  • I'm sure there are non command-line solutions: the OP didn't even specified if it was iOS or not, or if he tried classic steps from previous questions on the matter. – Cœur Oct 22 '18 at 02:28
  • I am sure there are not :D because you simply cannot shutdown simulators stuck in memory... You could use Activity monitor to shutdown CoreSimulator proceses, but you need to be careful not to kill some which cannot be rebooted until reboot of computer... – Dominik Bucher Oct 22 '18 at 05:26
  • I mean: this question about _"simulator unable to boot"_ is a duplicate of [Unable to run app in Simulator: Xcode beta 6 iOS 8](https://stackoverflow.com/questions/24033417/unable-to-run-app-in-simulator-xcode-beta-6-ios-8) which has already 28 answers, and none of them is using `xcrun`. – Cœur Oct 22 '18 at 05:33
  • :) good to know – Dominik Bucher Oct 22 '18 at 05:40
  • 2
    Perfect answer for this fix is https://stackoverflow.com/a/48075384/4439983 – Noor Mar 26 '19 at 08:01
  • 1
    Worked on Xcode 11.2 – Touhid Nov 11 '19 at 18:28