Skip to content

Instantly share code, notes, and snippets.

@gngrwzrd
Forked from rnapier/fix-xcode
Last active December 23, 2015 11:28
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gngrwzrd/6628214 to your computer and use it in GitHub Desktop.
Save gngrwzrd/6628214 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#original script by Rob Napier <robnapier@gmail.com>
#updates by github.com/gngrwzrd
#Script to link in all your old SDKs every time you upgrade Xcode
#Create a directory somewhere to store older SDKs in
#Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
#Under those, store the SDKs:
# MacOSX10.6.sdk MacOSX10.7.sdk MacOSX10.8.sdk iPhoneOS6.1.sdk iPhoneSimulator6.1.sdk etc
#run this script like:
#python fix-xcode.py --xcode=/Applications/Xcode.app --platforms=/SDKs
import argparse,subprocess,os,re
parser = argparse.ArgumentParser()
parser.add_argument('--xcode',help='path to Xcode',nargs="?")
parser.add_argument("--platforms",help="path to platform folders with SDKs",nargs="?")
args = parser.parse_args()
source_path = args.platforms
if re.search("~",source_path): source_path = os.path.expanduser(source_path)
source_path = os.path.abspath(source_path)
if args.xcode: dest_path = args.xcode
else: dest_path = subprocess.check_output(["xcode-select", "--print-path"]).rstrip()
if not dest_path.endswith("/Contents/Developer"): dest_path += "/Contents/Developer"
for platform in os.listdir(source_path):
if re.search("platform",platform) == None:
continue
#print platform
#print "command:"
print "ln -sf %(source_path)s/%(platform)s/* %(dest_path)s/Platforms/%(platform)s/Developer/SDKs" % locals()
subprocess.call("ln -sf %(source_path)s/%(platform)s/* %(dest_path)s/Platforms/%(platform)s/Developer/SDKs" % locals(), shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment