simctl delete, Unable to delete device in current state: Creating
Asked Answered
R

1

5

I am trying to delete a Simulator but it is in a state which simctl delete will not delete it. I removed it from all the places I can think, but a reference to it is preserved somewhere.

First, the listing:

    $ xcrun simctl list devices | grep 3B7
       Apple Watch - 38mm (3B7135C5-40A3-40FB-A130-12ACB448EE5D) (Creating) (unavailable, runtime profile not found)

Next, my delete attempt:

    $ xcrun simctl delete 3B7135C5-40A3-40FB-A130-12ACB448EE5D
    An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
    Unable to delete device in current state: Creating

I next deleted the device directory, the entry from device_set.plist, and even the entry in .default_created.plist. Proof:

    $ pwd; ls -l 3*
    /Users/jeff/Library/Developer/CoreSimulator/Devices
    ls: 3*: No such file or directory
    $ grep 3B7 device_set.plist .default_created.plist ; echo Anything?
    Anything?

But that did not help. It was still there.

So without deleting the entire CoreSimulator/Devices folder, how do I remove this corrupt device entry?

Roice answered 14/9, 2016 at 16:46 Comment(0)
F
16

You deleted it on disk, but CoreSimulatorService was running during that time and has no idea that you undermined its authority ;0.

If you sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService, it'll restart and not see it on the next launch.

Also note that this particular bug was fixed in Xcode 8. You can now delete unavailable devices stuck in the creating state.

Fumigant answered 15/9, 2016 at 6:32 Comment(5)
So what I did was run simctl delete while CoreSimulatorService was running. And it is running even before I ever start my first Simulator from Xcode. And a reboot cleaned up the "Creating" mess. Killing the process as you suggested probably would have done it, too.Roice
CoreSimulatorService only starts if it is used (launching Xcode, Simulator, Instruments, xcodebuild, etc.). Launching Console.app on Sierra will also start it.Fumigant
Thanks, Jeremy, great help! Maybe the bug was fixed in Xcode8 - but for sure, it was re-introduced for Xcode 9 ! (since in there, again, I cannot delete unavailable devices in the Creating state). With your great help, I was able to killall :) (....of course, being slightly incautious having deleted the simulator-device while compiling in the first place....)Larynx
Xcode 10 has the same issue. CoreSimulatorService will be started before simctl delete, so your method does not work for me. It's really annoying.Soni
After restarting macOS, simulator profiles in the creating state disappeared automatically.Soni

© 2022 - 2024 — McMap. All rights reserved.