Skip to content

Conversation

@justice-adams-apple
Copy link
Contributor

  • Ensure a macOS SDK is installed when verifying system prerequisites, if it is not installed. Warn the user at install time

The warning that the end-user will receive is the following (currently):

WARNING: Could not find a macOS SDK on the system. A macOS SDK is required for the toolchain to work correctly. Please install one via Xcode (https://developer.apple.com/xcode) or run the following command on your machine to install the command line developer tools: xcode-select --install.

If developer tools are located at a non-default location on disk, use sudo xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools.

@justice-adams-apple justice-adams-apple changed the title Ensure the macOS SDK exists and is correct at install time Ensure the macOS SDK exists at install time Dec 11, 2025
// shell script for installing developer tools on macOS.
if !result.terminationStatus.isSuccess {
await ctx.print("""
\nWARNING: Could not find a macOS SDK on the system. A macOS SDK is required for the toolchain to work correctly. Please install one via Xcode (https://developer.apple.com/xcode) or run the following command on your machine to install the command line developer tools: `xcode-select --install`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\nWARNING: Could not find a macOS SDK on the system. A macOS SDK is required for the toolchain to work correctly. Please install one via Xcode (https://developer.apple.com/xcode) or run the following command on your machine to install the command line developer tools: `xcode-select --install`.
\nWARNING: Could not find a macOS SDK on the system. A macOS SDK is required for the toolchain to work correctly. Please install one via Xcode (https://developer.apple.com/xcode) or run the following command on your machine to install the Command Line Tools for Xcode `xcode-select --install`.

// shell script for installing developer tools on macOS.
if !result.terminationStatus.isSuccess {
await ctx.print("""
\nWARNING: Could not find a macOS SDK on the system. A macOS SDK is required for the toolchain to work correctly. Please install one via Xcode (https://developer.apple.com/xcode) or run the following command on your machine to install the command line developer tools: `xcode-select --install`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: To make it easier for users to copy/paste the command it should go an a separate line here.

@finagolfin
Copy link
Member

Are you sure the command-line tools install includes Foundation and XCTest? I installed those CLI tools alone and I was able to build against Testing, which it definitely includes, but not Foundation and XCTest, until I installed Xcode. It's possible I misconfigured something else though, as this is the first time I'm using these Swift tools on macOS.

@cmcgee1024
Copy link
Member

Foundation is there in the CLT's version of the macOS SDK, but not XCTest.

@shahmishal shahmishal merged commit 20ceb47 into main Dec 12, 2025
45 of 46 checks passed
@shahmishal
Copy link
Member

@justice-adams-apple can you cherry-pick this on release/1.1?

@finagolfin
Copy link
Member

I think the core libraries that require Xcode should be listed out too, as many Swift packages won't compile or test for macOS without XCTest.

justice-adams-apple added a commit that referenced this pull request Dec 13, 2025
* Ensure the macOS SDK exists at install time

* update warning messaging

* remove backticks

(cherry picked from commit 20ceb47)
shahmishal pushed a commit that referenced this pull request Dec 13, 2025
* Ensure the macOS SDK exists at install time (#480)

* Ensure the macOS SDK exists at install time

* update warning messaging

* remove backticks

(cherry picked from commit 20ceb47)

* Fix SDK logic for 1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants