37

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?

Todd Ditchendorf
  • 11,217
  • 14
  • 69
  • 123

4 Answers4

85

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
gblazex
  • 49,155
  • 12
  • 98
  • 91
Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • This is amazing tip. Works for iPhoneOS too, just change to appropriate paths – Aleksandar Vacić Sep 10 '13 at 22:34
  • 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. – HyBRiD Sep 11 '13 at 12:21
  • how can you ensure that the project is built with the proper SDK when archiving? – ohayon Sep 11 '13 at 16:16
  • 7
    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/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. – plusbryan Sep 12 '13 at 20:42
  • 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. – Jason Sep 19 '13 at 17:19
  • I modified that script to be a bit more robust. https://gist.github.com/gngrwzrd/6628214 – gngrwzrd Sep 19 '13 at 19:05
  • How does one use that script so the permissions aren't screwy? – Bob Spryn Oct 25 '13 at 09:06
  • 1
    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? – Ryan Ballantyne Nov 03 '13 at 07:23
  • 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. – kraftydevil May 08 '14 at 16:36
  • 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. – Rob Napier May 08 '14 at 18:10
  • 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/iPhoneOS.platform/Info.plist then change it, no need to convert it back to binary to make it work (except maybe performance) – Jens Apr 27 '16 at 12:22
  • Using the symlink worked on Xcode 8 beta to link to 10.11 SDK located in Xcode 7.3. – dbainbridge Jun 18 '16 at 12:58
  • MinimumSDKVersion is AMAZING! Thank you – MattD Aug 30 '16 at 15:53
  • 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. https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW47 Xcode9 finally (*finally!*) can detect that you've used unsupported features, so this technique should be less necessary. – Rob Napier Aug 07 '17 at 23:26
21

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)

danielpunkass
  • 17,527
  • 4
  • 24
  • 38
  • 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. – Todd Ditchendorf Jul 11 '12 at 03:09
  • 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. – ctlockey Sep 23 '13 at 23:35
  • 3
    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. – Jono Guthrie Sep 23 '14 at 03:42
  • Writing `Wrong approach.` without explaining why it is wrong, it is wrong approach ;). Simply nobody can verify or evaluate your claim. – Marek R Jan 18 '22 at 18:15
0

Why not just symbolic link the SDK's? "ln -s"? If that doesn't work there's going to be some plist hacking required.

Byron
  • 1,091
  • 11
  • 27
0

Solved by browsing to older version Xcode.App/Developer/platforms and copy the iOS 6.1 SDK into same folder of XCode 5.

Guesto
  • 1