Search code examples
iosxcodesimulatorui-testingparallel-testing

How do I erase an Xcode 10 simulator clone through CLI?


Do they share the same UDID? How are they implemented under the hood?

The scenario is I have 4 clones running UI tests in parallel. I need a clean simulator for some tests (but want to keep random test order)


Solution

  • Command to erase all testing simulators (you'll need to restart Xcode after that):

    xcrun simctl --set testing delete all
    

    Overall, it should be better to just reset those sims (you won't need to restart after that):

    xcrun simctl --set testing shutdown all
    xcrun simctl --set testing erase all
    

    To erase specific one you first need to get his ID with list devices and then shutdown and erase:

    xcrun simctl --set testing list devices
    xcrun simctl --set testing shutdown 2BC2B50E-C4BA-45B9-9C73-AF5097BA1F0B
    xcrun simctl --set testing erase 2BC2B50E-C4BA-45B9-9C73-AF5097BA1F0B
    

    Thanks Scott McCoy for his answer.