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.

Steps to install Xcode Command Line Tools on macOS:

  1. Open Terminal and check whether an active Apple developer directory is already configured.
    $ 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.

  2. Request the standalone Command Line Tools installer from the signed-in desktop session.
    $ 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.

  3. Click Install in the Software Update dialog and accept the license if macOS asks for it.
  4. Wait for macOS to download and install the package.

    The download size and install time vary by release and connection speed. Close the prompt only after macOS reports that the software was installed.

  5. Confirm that the developer directory now points to the installed toolchain.
    $ 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.

  6. Verify that the compiler toolchain responds without another install prompt.
    $ 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.