Skip to content

Instantly share code, notes, and snippets.

@dynamicguy
Last active April 2, 2025 11:58
Show Gist options
  • Save dynamicguy/e8756a9f0f50af86d6e746d4b1ab6a09 to your computer and use it in GitHub Desktop.
Save dynamicguy/e8756a9f0f50af86d6e746d4b1ab6a09 to your computer and use it in GitHub Desktop.

Revisions

  1. dynamicguy revised this gist Nov 6, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion recreate_all_ios_simulators.rb
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@
    device_types['devicetypes'].each do |device_type|
    runtimes['runtimes'].select{|runtime| runtime['availability'] == '(available)'}.each do |runtime|
    puts "Creating #{device_type['name']} with #{runtime['name']}"
    command = "xcrun simctl create '#{device_type['name']} #{runtime['name']}' #{device_type['identifier']} #{runtime['identifier']}"
    command = "xcrun simctl create '#{device_type['name']}' #{device_type['identifier']} #{runtime['identifier']}"
    command_output = `#{command}`
    sleep 0.5
    end
  2. dynamicguy created this gist Nov 6, 2016.
    25 changes: 25 additions & 0 deletions recreate_all_ios_simulators.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    #!/usr/bin/env ruby
    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    require 'JSON'

    device_types = JSON.parse `xcrun simctl list -j devicetypes`
    runtimes = JSON.parse `xcrun simctl list -j runtimes`
    devices = JSON.parse `xcrun simctl list -j devices`

    devices['devices'].each do |runtime, runtime_devices|
    runtime_devices.each do |device|
    puts "Removing device #{device['name']} (#{device['udid']})"
    `xcrun simctl delete #{device['udid']}`
    end
    end

    device_types['devicetypes'].each do |device_type|
    runtimes['runtimes'].select{|runtime| runtime['availability'] == '(available)'}.each do |runtime|
    puts "Creating #{device_type['name']} with #{runtime['name']}"
    command = "xcrun simctl create '#{device_type['name']} #{runtime['name']}' #{device_type['identifier']} #{runtime['identifier']}"
    command_output = `#{command}`
    sleep 0.5
    end
    end