fastlane-old / snapshot

Automate taking localized screenshots of your iOS app on every device
https://fastlane.tools
1.95k stars 140 forks source link

Erase or delete and restore existing simulators #351

Closed ZevEisenberg closed 8 years ago

ZevEisenberg commented 8 years ago

I usually work with a subset of the normal simulators, or maybe with, e.g., several sizes of iPhones running iOS 8.4 and 9.2. I sometimes want to blow away the contents of my simulators, but I don't want to have to re-delete the ones I don't want, and recreate the nonstandard ones I do want. What I'd like is a way to programmatically choose SimulatorReset Content and Settings… for each simulator that is currently enabled.

Here's how I currently do it:

function resetAllSimulators () {
    osascript -e 'tell application "iOS Simulator" to quit'
    osascript -e 'tell application "Simulator" to quit'
    xcrun simctl list devices | grep -v '^[-=]' | cut -d "(" -f2 | cut -d ")" -f1 | xargs -I {} xcrun simctl erase "{}"
}

But it seems like it would make perfect sense for this to be built into snapshot.

ZevEisenberg commented 8 years ago

Thanks to @DimaVartanian, I found out that you can just use xcrun simctl erase all. You'll probably want to quit the simulator first, so the osascript above may be useful, but this probably doesn't need to be in snapshot. Feel free to reopen if you think otherwise.

fastlanebot commented 8 years ago

This issue was migrated to https://github.com/fastlane/fastlane/issues/2525. Please post all further comments there.

fastlane is now a mono repo, you can read more about the change in our blog post. All tools are now available in the fastlane main repo :rocket: