-
-
Save perdona/263e222057f11e23c947db550d2bc04d to your computer and use it in GitHub Desktop.
Resets all iOS, watchOS, and tvOS simulators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const execSync = require('child_process').execSync; | |
const json = JSON.parse(execSync('xcrun simctl list --json')); | |
for (const runtime of Object.keys(json.devices)) { | |
for (const device of json.devices[runtime]) { | |
console.log(`Removing ${device.name} (${device.udid})`); | |
execSync(`xcrun simctl delete ${device.udid}`); | |
} | |
} | |
for (const deviceType of json.devicetypes) { | |
for (const runtime of json.runtimes) { | |
if (runtime.isAvailable || runtime.availability === '(available)') { | |
console.log(`\nCreating ${deviceType.name} with ${runtime.name}`); | |
try { | |
execSync(`xcrun simctl create '${deviceType.name} ${runtime.name}' ${deviceType.identifier} ${runtime.identifier}`); | |
console.log('SUCCESS!'); | |
} catch (e) {} | |
} | |
} | |
} | |
console.log(); | |
console.log(execSync('xcrun simctl list').toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment