Knowledge
How to install the Xcode Command Line Tools on macOS
#CommandLine
Install the Xcode Command Line Tools on macOS to get git, clang, make and more, plus how to verify, reset, and reinstall them.
Published by Mark van Eijk on June 23, 2026 · 2 minute read
- Why you need the Command Line Tools
- Installing the tools
- Verifying the install
- What you get
- Resetting and reinstalling
- Next steps
Why you need the Command Line Tools
On a fresh Mac, most developer tooling won't work until you install the Xcode Command Line Tools. This is a lightweight package (you don't need the full multi-gigabyte Xcode app) that gives you the compilers and utilities everything else builds on: git, clang, make, gcc, header files, and more. It's also a hard prerequisite for Homebrew and countless other dev tools.
Installing the tools
There's one command to remember:
xcode-select --install
This pops up a small dialog asking you to confirm. Click Install, agree to the license, and macOS downloads and installs the package for you. It takes a few minutes depending on your connection.
If the tools are already installed, you'll see a message saying so, which is harmless.
Verifying the install
Once it finishes, confirm where the tools live with -p (print path):
xcode-select -p
You should get something like /Library/Developer/CommandLineTools. To check the individual binaries are on your PATH, ask them for their versions:
git --version
gcc --version
clang --version
make --version
Each should print a version string. On macOS, gcc is actually a wrapper around Apple's clang, so don't be surprised if gcc --version mentions clang.
What you get
Beyond the headline tools, the package bundles the C/C++ toolchain, make, git, svn, the linker, and the system headers that native extensions compile against. This is why installing Node modules with native bindings, Ruby gems, or Python packages with C extensions all "just work" afterwards.
Resetting and reinstalling
Sometimes a macOS upgrade leaves the tools in a confused state and you get errors like tool 'xcodebuild' requires Xcode. The first thing I try is resetting the active developer directory:
sudo xcode-select --reset
That points xcode-select back at the default location. If the tools are genuinely broken or missing, remove and reinstall them. Delete the folder, then run the installer again:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
The rm -rf here is safe because that directory is owned entirely by the tools package; reinstalling recreates it cleanly.
Next steps
With the Command Line Tools in place, you've got a working compiler and git out of the box. From here the usual next move is installing Homebrew, which depends on exactly these tools, and from there the rest of your stack. If you run into a "command not found" after install, open a new terminal window so it picks up the updated environment.
Subscribe to our newsletter
Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!
Related articles
Argument list too long (Bash: /bin/rm)
Install the Xcode Command Line Tools on macOS to get git, clang, make and more, plus how to verify, reset, and reinstall them.
How to install Composer packages locally
Install the Xcode Command Line Tools on macOS to get git, clang, make and more, plus how to verify, reset, and reinstall them.