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

5

12

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)

Waste answered 5/10, 2018 at 7:3 Comment(0)
F
15

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.

Fruiter answered 4/1, 2020 at 3:0 Comment(1)
But how do I reset a specific one? Tests are still running on others, and I need to reset one to prepare it for the "clean slate" testWaste
I
2

I have not been able to find any interface with cloned simulators via simctl. You can completely remove them by deleting their folder under ~/Library/Developer/XCTestDevices. They each get their own UUID, but again, they don't get listed in simctl as far as I can tell.

Improvement answered 11/7, 2019 at 17:0 Comment(0)
P
2

You can list clones like this: xcrun simctl --set testing list

But any time I try to use device IDs with xcrun commands they fail with Invalid device: <device id>

Playlet answered 12/12, 2019 at 20:45 Comment(0)
F
0

On your status bar with Xcode open on your mac go to Windows->Devices and Simulators. There you will see a list of all the available simulators and you can add new or delete existing from there.

Furry answered 5/10, 2018 at 7:32 Comment(1)
Hi, thanks for your answer. I am not seeking to remove a simulator but to erase its data - similar to what Erase all content and settings does but through terminalWaste
N
0

you can reset all the simulators by: xcrun simctl erase all

to reset a particular simulator use: xcrun simctl erase your_simulator_id

Numerous answered 15/10, 2018 at 18:44 Comment(2)
So as per question, I'm looking to erase a particular clone. How do I find the clones simulator id?Waste
xcrun instruments -s will give you the ids of all simulatorsNumerous

© 2022 - 2024 — McMap. All rights reserved.