Skip to content

Instantly share code, notes, and snippets.

@croath
Created April 23, 2014 06:52
Show Gist options
  • Save croath/11204989 to your computer and use it in GitHub Desktop.
Save croath/11204989 to your computer and use it in GitHub Desktop.
Remove specific apps installed in iPhone simulator.
require 'fileutils'
class String
def numeric?
return true if self =~ /^\d+$/
true if Float(self) rescue false
end
end
def remove_app (app_name)
sim_dir = '~/Library/Application Support/iPhone Simulator'
Dir.foreach(sim_dir) do |item|
next unless item[0].numeric?
Dir.foreach("#{sim_dir}/#{item}/Applications") do |sim_apps_folder|
full_sim_apps_folder = "#{sim_dir}/#{item}/Applications/#{sim_apps_folder}"
next unless File.directory?("#{full_sim_apps_folder}/#{app_name}.app")
FileUtils.rm_rf "#{full_sim_apps_folder}"
end
end
end
remove_app ARGV[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment