Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Remove Xcode duplicated simulators
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from subprocess import Popen, PIPE
from subprocess import call
p = Popen(["xcrun","simctl","list","devices"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = p.communicate(b"input data that is passed to subprocess' stdin")
blocks = re.split("--\s+(.*?)\s+--",output)
dic = {}
for block in blocks:
matches = re.findall("iOS 8.4",block)
if len(matches)>0:
content = blocks[i+1]
lines = content.split("\n")
for line in lines:
line = line.strip()
if len(line)>0:
match = re.match("(.*?)\(",line)
if match:
devicename =
idMatch = re.match(".*?\((.*?)\).*",line)
dic[devicename] =
# print
# print line
i = i+1
for guid in dic.itervalues():

This comment has been minimized.

Copy link

@lammertw lammertw commented Aug 7, 2015

When I run this it's not doing anything. I still have all duplicate simulators afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment