Reset the contents and settings all iOS-simulators
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
With Xcode 10:
#!/usr/bin/env sh
xcrun simctl shutdown all
xcrun simctl erase all
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