Skip to content

Why Xcode Command Line Tools is necessary? Why Xcode or self-installed ones don't work? #5408

Answered by Bo98
xycabcd asked this question in Everyday usage
Discussion options

You must be logged in to vote

GCC uses the macOS SDK. The Command Line Tools are installed in a fixed location so we can always find the SDK at /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk.

Xcode app however can be installed anywhere on the system - it might be /Applications/Xcode.app, but not always. GCC doesn't have code that tries to search the system for SDK like Apple's Clang does, so the SDK at /Library/Developer/CommandLineTools is the one used.

If you aren't using the latest macOS version, there's an additional reason: the Xcode app doesn't ship the macOS SDK for older macOS but the Command Line Tools does.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@xycabcd
Comment options

@Bo98
Comment options

Answer selected by xycabcd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants