Installing Xcode Command Line Tools on macOS adds Apple's compiler, SDK headers, developer shims, and build utilities that many terminal workflows expect. They are required for common tasks such as compiling code, building native extensions, and satisfying prerequisites for tools like Homebrew.
The standalone package installs into /Library/Developer/CommandLineTools and provides the active developer directory when the Mac is using the lightweight tools package instead of full Xcode. The xcode-select utility requests the package through Software Update, while commands such as clang and xcrun resolve through that selected developer path after the install finishes.
The install request opens a graphical dialog, so it must be started from a signed-in desktop session rather than a headless shell. If full Xcode is already installed, a separate Command Line Tools install is usually unnecessary, and xcode-select can report an Xcode.app developer directory instead of the standalone package path.
Related: How to install Homebrew on macOS
$ xcode-select --print-path /Library/Developer/CommandLineTools
If this command prints /Library/Developer/CommandLineTools or an Xcode.app developer path, the Mac already has Apple developer tools available. If it reports that no active developer directory is set, continue with the install request.
$ xcode-select --install
Run this as the logged-in user in a normal macOS desktop session. The command opens a graphical Software Update dialog, so using sudo or a non-GUI SSH session can prevent the installer prompt from appearing.
The download size and install time vary by release and connection speed. Close the prompt only after macOS reports that the software was installed.
$ xcode-select --print-path /Library/Developer/CommandLineTools
If full Xcode is installed and selected instead, this command can return /Applications/Xcode.app/Contents/Developer. That still means the Apple developer toolchain is available, but full Xcode is the active path.
$ clang --version Apple clang version 17.0.0 (clang-1700.6.4.2) Target: arm64-apple-darwin25.3.0 Thread model: posix
The exact version string changes over time. The important result is that clang opens normally and reports an Apple clang build.