Skip to content

Find the macOS SDK when only the Command Line Tools are installed - #2614

Open
iurisilvio wants to merge 1 commit into
Automattic:masterfrom
iurisilvio:macos-sdk-command-line-tools
Open

Find the macOS SDK when only the Command Line Tools are installed#2614
iurisilvio wants to merge 1 commit into
Automattic:masterfrom
iurisilvio:macos-sdk-command-line-tools

Conversation

@iurisilvio

Copy link
Copy Markdown
Contributor

Building on a Mac without a full Xcode fails at the link step, after compiling every dependency:

error: warning: unable to open library directory
'/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.sdk/usr/lib': FileNotFound

Platforms/MacOSX.platform/Developer/SDKs/ only exists inside an Xcode installation. With the Command Line Tools selected, xcode-select --print-path returns /Library/Developer/CommandLineTools and the SDKs sit directly under SDKs/.

Changes

Look for the pinned SDK in both layouts, and fall back to whatever xcrun --show-sdk-path reports if it is in neither — a machine whose Xcode ships a newer SDK still builds rather than failing on a path that does not exist.

Verification

macOS 26.0 arm64, Command Line Tools only (no Xcode), zig 0.16.0: zig build succeeds and the full suite passes (305 tests). I do not have a full Xcode here to exercise the first candidate, but it is the path the code builds today and the probe only falls through when it is missing.

  • Have you updated CHANGELOG.md? — no user-visible change

The SDK path was built as `xcode-select --print-path` plus
`Platforms/MacOSX.platform/Developer/SDKs/`, which only exists inside a full
Xcode. With the Command Line Tools selected the SDKs sit directly under
`SDKs/`, so the link step failed with

    warning: unable to open library directory
    '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.sdk/usr/lib'

after compiling everything.

Look for the pinned SDK in both layouts, and fall back to whichever SDK xcrun
considers active if it is in neither.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant