Reset the contents and settings all iOS-simulators

15,917

Solution 1

I present,

The Definitive iOS Simulator Reset Script (link)

enter image description here

Based on Oded Regev's code from this SO question (which was based on Jacob Rus's fine "menu_click" code)

Solution 2

Based on the the answer from Jeremy Huddleston Sequoia I wrote a shell script that will reset all simulators.

For Xcode 7 you can use:

#!/bin/sh

instruments -s devices \
| grep "(\d[.0-9]\+) \[[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}\]" \
| grep -o "[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}" \
| while read -r line ; do
    echo "Reseting Simulator with UDID: $line"
    xcrun simctl erase $line
done

For previous versions use:

#!/bin/sh

instruments -s devices \
 | grep Simulator \
 | grep -o "[0-9A-F]\{8\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{4\}-[0-9A-F]\{12\}" \
 | while read -r line ; do
    echo "Reseting Simulator with UDID: $line"
    xcrun simctl erase $line
done

Solution 3

With Xcode 6, you can use the simctl command line utility:

xcrun simctl erase <device UDID>

With Xcode 7, you can erase all at once with:

xcrun simctl erase all

Solution 4

With Xcode 10:

#!/usr/bin/env sh

xcrun simctl shutdown all
xcrun simctl erase all

Solution 5

you can run this command xcrun simctl erase all

Share:
15,917
Lithu T.V
Author by

Lithu T.V

#CodeLover # An iOS/Swift developer by passion...Dealing with Software project management kinds of stuff Digital Media Platform SME #Techie #Pubg #Manga #NightOwl #Reader #Rider #shutterBug #songTracker #BingeWatcher #movieJunkie

Updated on June 05, 2022

Comments

  • Lithu T.V
    Lithu T.V about 2 years

    Is there any option to reset the contents and settings of all the simulators ?In a single event or a single command via command line?