The simulator instance I'm using is sometimes left in an inconsistent state after a continuous integration run, how do I reset it?
It does not seem that resetting the simulator that runs in a normal user account on the build server will reset the simulator that is used by the Bots (which is run under the restricted _xcsbuild
user.)
Inspired by this gist, run this script as a "Before Integration" trigger on your Bot:
/usr/bin/osascript -e 'tell application "iOS Simulator" to quit'
/usr/bin/osascript -e 'tell application "Simulator" to quit'
/usr/bin/xcrun simctl erase all
... and dupe radar 24091918 to add "all" as a valid argument to xcrun simctl shutdown
.