How to point Xcode to an old SDK so it can be used as a "Base SDK"?

51,838

Solution 1

You'll need to add a symlink to the old SDK (this is generally easier than copying).

cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
ln -s /path/to/old/SDK .

This works fine back to 10.5. Beyond that things get a little more complicated...

While there's no promise in future versions of Xcode that this will be supported, I've chatted with the Xcode team about it and they don't seem keen on changing it anytime soon.

Personally I often keep /path/to/old/SDK in a top-level directory called /SDKs. That way every time I upgrade it's easy to fix everything up.

EDIT: I have a fix-xcode script that simplifies re-applying this fix every time Xcode upgrades.


UPDATE: In modern versions of Xcode (7.3+) to use older SDKs edit MinimumSDKVersion here:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist

Solution 2

Wrong approach. You don't "point" Xcode at an SDK. Instead you will have better luck copying the SDK into the appropriate "SDKs" folder for the Xcode installation. In modern Xcode installations this is usually:

Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

Copy the SDK in there, quit and restart Xcode and see what you find.

(reading the other answer here I think that symbolic linking might be an option if you are dead-set on keeping the original SDK elsewhere)

Share:
51,838
Rohan
Author by

Rohan

Developer of Fluid, Fake, Shapes, and some other stuff. #SOreadytohelp

Updated on April 04, 2020

Comments

  • Rohan
    Rohan about 4 years

    My Mac's Setup:

    Volume A:
    OS X 10.8
    Xcode 4.5 or later - 10.6 SDK IS NOT available as Base SDK

    Volume B:
    OS X 10.7
    Xcode 4.3.3 - 10.6 SDK IS available as Base SDK

    Volume C:
    OS X 10.6
    Xcode 4.2 - 10.6 SDK IS available as Base SDK


    On Volume A, I have installed Xcode 4.5, which does not include the 10.6 SDK as an available "Base SDK" in my Build Targets' Build Settings.

    I have a separate 10.6 volume and 10.7 volume on this hard drive - both of which have Xcode installed, and both of which allow me to select the 10.6 SDK as a Base SDK in my Xcode Build Targets' Build Settings.

    I know that I have the 10.6 SDK installed on Volume C (at /Developer/SDKs from an older Xcode installation).

    How can I point Xcode on Volume A to the 10.6 SDK which lives on Volume C?

  • Rohan
    Rohan almost 12 years
    Yes, but the problem was I didn't even know where to symbolic link it to. No worries, others have answered with the info I need.
  • Rohan
    Rohan almost 12 years
    Thanks Daniel, just what I needed. I didn't know where the SDKs folder had gone to. Should have guessed it was stored inside Xcode.app these days.
  • Aleksandar Vacić
    Aleksandar Vacić almost 11 years
    This is amazing tip. Works for iPhoneOS too, just change to appropriate paths
  • HyBRiD
    HyBRiD almost 11 years
    Note that Xcode doesn't display the different SDKs' names. You get multiple selections with the same name. Find through trial and error which one is your desired SDK.
  • ohayon
    ohayon almost 11 years
    how can you ensure that the project is built with the proper SDK when archiving?
  • plusbryan
    plusbryan almost 11 years
    This worked great for me in Xcode5 and iOS. My steps: cd into Xcode5's SDK dir. Add a symbolic link to the old SDK like this: ln -s /Applications/Xcode4.app/Contents/Developer/Platforms/iPhone‌​OS.platform/Develope‌​r/SDKs/iPhoneOS6.1.s‌​dk iPhoneOS6.1.sdk Using this method, Xcode shows the old SDK's name in the list alongside the newest SDK.
  • Jason
    Jason almost 11 years
    For what it's worth, you need to copy the simulator SDKs too, and then be sure to run the simulator against the right version.
  • gngrwzrd
    gngrwzrd almost 11 years
    I modified that script to be a bit more robust. gist.github.com/gngrwzrd/6628214
  • ctlockey
    ctlockey almost 11 years
    I found this as a simpler solution than getting into the smylink as Rob Napier suggests. I only needed 6.1 since 7.0 just came out and blew up my 6.0-based app's interface.
  • Bob Spryn
    Bob Spryn over 10 years
    How does one use that script so the permissions aren't screwy?
  • Ryan Ballantyne
    Ryan Ballantyne over 10 years
    Running Xcode 5.0.1 on Mavericks, I had to copy the SDK, not symlink, to get it to work. It didn't seem to want to follow the symlink. Might be a security thing, maybe?
  • kraftydevil
    kraftydevil about 10 years
    Echoing @RyanBallantyne, for Xcode 5.1 on Mavericks using the iOS 7.0 sdk, I had to copy the full SDK folders and restart Xcode to get this working.
  • Rob Napier
    Rob Napier about 10 years
    I haven't had any trouble following symlinks. I still use my original fix-xcode script every Xcode upgrade (and on several new machines, too). I wonder why the difference.
  • Jono Guthrie
    Jono Guthrie almost 10 years
    I disagree - adding the actual SDK gets nuke on major upgrades. Keeping older SDK's around at the root level is a better more stable long term option.
  • Jens
    Jens about 8 years
    for those, wondering how to edit the Info.plist for iPhone: it is in binary format and needs to be converted first sudo plutil -convert xml1 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneO‌​S.platform/Info.plis‌​t then change it, no need to convert it back to binary to make it work (except maybe performance)
  • dbainbridge
    dbainbridge about 8 years
    Using the symlink worked on Xcode 8 beta to link to 10.11 SDK located in Xcode 7.3.
  • MattD
    MattD almost 8 years
    MinimumSDKVersion is AMAZING! Thank you
  • Rob Napier
    Rob Napier almost 7 years
    That doesn't shock me; they did a major rewrite and probably broke it finally. It was never supported. The recommended solution is to set the Deployment Target. developer.apple.com/library/content/documentation/IDEs/… Xcode9 finally (finally!) can detect that you've used unsupported features, so this technique should be less necessary.
  • Marek R
    Marek R over 2 years
    Writing Wrong approach. without explaining why it is wrong, it is wrong approach ;). Simply nobody can verify or evaluate your claim.