Managing Xcode 10 Simulator Clones via Command Line Interface (CLI)

Managing Xcode 10 Simulator Clones via Command Line Interface (CLI)

11 April 2024 Stephan Petzl Leave a comment Tech-Help

When running UI tests in parallel on multiple simulator clones, it’s crucial to maintain a clean testing environment. In Xcode 10, developers often need to erase or reset simulators to ensure consistent test results. This guide will walk you through the process of managing simulator clones through CLI, providing a clean slate for your tests without affecting the random test order.

Erase All Testing Simulators

If you’re looking to erase all testing simulators, the following command will do just that:

xcrun simctl --set testing delete all

Note: After using this command, you will need to restart Xcode to apply the changes.

Resetting Simulators

Instead of deleting simulators, you might prefer to reset them. Resetting is often a better option as it does not require restarting Xcode afterwards. To reset all testing simulators, execute the following commands:

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

Erase a Specific Simulator Clone

To erase a specific simulator clone, you must first retrieve its unique identifier (ID). You can list all devices and their IDs with this command:

xcrun simctl --set testing list devices

Once you have the ID of the simulator you want to erase, use the following commands to shut it down and then erase it:

xcrun simctl --set testing shutdown [simulator ID]
xcrun simctl --set testing erase [simulator ID]

Replace [simulator ID] with the actual ID of the simulator you obtained from the list. For example:

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


Using the CLI to manage your Xcode simulator clones can significantly streamline your testing process. Whether you need to delete all clones to start fresh or selectively reset specific instances, the above commands provide a straightforward approach to maintaining a clean and controlled testing environment.

Like this article? there’s more where that came from!