Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reset the contents and settings all iOS-simulators

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?

like image 265
Lithu T.V Avatar asked Mar 12 '13 15:03

Lithu T.V


2 Answers

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
like image 147
Daniel Wood Avatar answered Sep 19 '22 19:09

Daniel Wood


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
like image 22
Jeremy Huddleston Sequoia Avatar answered Sep 20 '22 19:09

Jeremy Huddleston Sequoia