How to use a lower version macos SDK?

My macos update automatically and the new macos SDK are not fit for my program, so how to use a lower version macos SDK? And I have another problem, once I installed Xcode, the SDK will be set path to Xcode path, also I have a command line path which is /Library/Developer/CommandlineTools. In this path, there is also a SDKs directory which contains some different versions of macos SDK? How to set a default SDK path?

Answered by szymczyk in 812046022

Why do you want to use an older version of the macOS SDK?

If you want your app to run on older versions of macOS, you can set the deployment target of the app to a lower version. The deployment target is the earliest version of macOS that can run your app. You can change the deployment target by taking the following steps:

  1. Select your project from the left side of the project window to open the project editor.
  2. Select your app target from the target list on the left side of the project editor.
  3. Click the General button at the top of the project editor.
  4. Use the menu in the Minimum Deployments section to choose the minimum macOS version for the app.

Why do you want to use an older version of the macOS SDK?

If you want your app to run on older versions of macOS, you can set the deployment target of the app to a lower version. The deployment target is the earliest version of macOS that can run your app. You can change the deployment target by taking the following steps:

  1. Select your project from the left side of the project window to open the project editor.
  2. Select your app target from the target list on the left side of the project editor.
  3. Click the General button at the top of the project editor.
  4. Use the menu in the Minimum Deployments section to choose the minimum macOS version for the app.

What szymczyk said plus…

Our tools are directly tied to the SDK that they ship with. Xcode 16, and the Xcode 16 command-line tools, ship with the macOS 15 SDK. There is no supported way to them with, for example, the macOS 14 SDK.

IMPORTANT If you poke around on the ’net you’ll see instructions for how to mix’n’match tools and SDKs. Don’t start down that path. This is very much unsupported and it’s likely to cause you grief.

It is possible to have multiple versions of Xcode (and command-line tools) installed. For example, my Mac is running macOS 14.7.1 and I have both Xcode 16 and Xcode 15 installed. If I launch the latter, I can build with the macOS 14 SDK.

But as szymczyk said, it’s generally best to just build with the latest tools, and hence the latest SDK, and set you deployment target lower.

For info on which Xcodes ship with with SDKs and where you can run them, see Developer > Support > Articles > Xcode.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

How to use a lower version macos SDK?
 
 
Q