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?
I present,
The Definitive iOS Simulator Reset Script (link)

Based on Oded Regev's code from this SO question (which was based on Jacob Rus's fine "menu_click" code)
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
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
Inspired by the answer from Daniel Wood, I came up with this one.
It solves the problem of what to do with a running simulator. Our CI environment leaves the simulator running after the tests run, and that's getting more tainted over time.
The guid detection isn't as accurate, but I think the readability trade-off is worthwhile.
#!/bin/bash
xcrun simctl list | grep Booted | grep -e "[0-9A-F\-]\{36\}" -o | xargs xcrun simctl shutdown
xcrun simctl erase all
Tested with the XCode 7.
With the latest version of Xcode command line tools you can call xcrun simctl erase all
Make sure to quit the sim every time you call this function or you'll get an error stating An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Unable to erase contents and settings in current state: Booted
you can run this command
xcrun simctl erase all
With Xcode 10:
#!/usr/bin/env sh
xcrun simctl shutdown all
xcrun simctl erase all
Simply go to ~/Library/Application Support/iPhone Simulator
and delete all the contents out of there. The above methods don't work on iOS 7, so this seemed to work for me.
I wrote a script that will reset the contents & settings of all versions and devices for the iOS Simulator. It grabs the device names and version numbers from the menu, so it will include any new devices or iOS versions that Apple releases simulators for.
It's easy to run manually or use in a build-script. I would suggest adding it as a Pre-Action Run Script before the build.
It's based heavily on Stian's script above, but doesn't become stale with new iOS versions, and eliminates the dialog box (better for automation build scripts).
You can call this command:
rm -rf ~/Library/Application Support/iPhone Simulator
There is a tool xctool - https://github.com/facebook/xctool which is replacement of xcodebuild. It allows to build application from command line as well as run tests for it. Besides running tests it is allows to provide arguments such as -freshSimulator and -freshInstall that resetting content for target simulator before executing tests. That simplifies a lot resetting of simulator, as you avoiding various magic with bash scripts etc everything encapsulated within tool.
To set the user content and settings of the simulator to their factory state and remove the applications you have installed, choose iPhone Simulator > Reset Content and Settings.
来源:https://stackoverflow.com/questions/15365179/reset-the-contents-and-settings-all-ios-simulators