How to point Xcode to an old SDK so it can be used as a "Base SDK"?
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)
Rohan
Developer of Fluid, Fake, Shapes, and some other stuff. #SOreadytohelp
Updated on April 04, 2020Comments
-
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 SDKVolume B:
OS X 10.7
Xcode 4.3.3 - 10.6 SDK IS available as Base SDKVolume 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 almost 12 yearsYes, 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 almost 12 yearsThanks 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ć almost 11 yearsThis is amazing tip. Works for iPhoneOS too, just change to appropriate paths
-
HyBRiD almost 11 yearsNote 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 almost 11 yearshow can you ensure that the project is built with the proper SDK when archiving?
-
plusbryan almost 11 yearsThis 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/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk iPhoneOS6.1.sdk
Using this method, Xcode shows the old SDK's name in the list alongside the newest SDK. -
Jason almost 11 yearsFor 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 almost 11 yearsI modified that script to be a bit more robust. gist.github.com/gngrwzrd/6628214
-
ctlockey almost 11 yearsI 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 over 10 yearsHow does one use that script so the permissions aren't screwy?
-
Ryan Ballantyne over 10 yearsRunning 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 about 10 yearsEchoing @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 about 10 yearsI 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 almost 10 yearsI 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 about 8 yearsfor 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/iPhoneOS.platform/Info.plist then change it, no need to convert it back to binary to make it work (except maybe performance)
-
dbainbridge about 8 yearsUsing the symlink worked on Xcode 8 beta to link to 10.11 SDK located in Xcode 7.3.
-
MattD almost 8 yearsMinimumSDKVersion is AMAZING! Thank you
-
Rob Napier almost 7 yearsThat 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 over 2 yearsWriting
Wrong approach.
without explaining why it is wrong, it is wrong approach ;). Simply nobody can verify or evaluate your claim.