xcode-select --install in Terminal and accept the dialog. The tools land in /Library/Developer/CommandLineTools, and xcode-select -p should print that path. If the installer reports the software is “not currently available from the Software Update server”, download the standalone Command Line Tools package for your macOS version from Apple’s developer downloads page instead.The Command Line Tools are a separate package from Xcode. There is no app in /Applications, no installer you double-click, and no environment script to source. You install the package once, and xcode-select records which copy of the tools your shell should use.
Why this happens
A fresh macOS install ships without clang, make, git, ld or the system headers. Those live in a developer directory, and there are two possible ones: /Library/Developer/CommandLineTools (the standalone package) or /Applications/Xcode.app/Contents/Developer (the full IDE). macOS does not guess which one you want — xcode-select stores the choice in a small config file, and every tool that matters (xcrun, clang, git, swift) reads it.
So “installing the command line tools” is really two steps: get the package onto disk, then make sure the active developer directory points at it. Skipping the second step is why people end up with tools present under Contents/Developer but nothing usable from the shell.
One historical note, because old tutorials still circulate: the “Downloads” tab inside Xcode’s preferences that used to host this package is long gone, and so are the direct adcdownload.apple.com links. Anything that tells you to open Xcode → Preferences → Downloads is describing Xcode 4/5 and will not match what you see today.
How to fix it
1. Use xcode-select --install (the normal path)
This is the supported, on-demand install and it works on every current macOS release:
xcode-select --install
A dialog appears asking whether to install the command line developer tools. Click Install and agree to the license. The download is a few hundred megabytes and takes a few minutes.
If the tools are already present, the command exits immediately with:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
That is not a failure — it means you are done. Verify:
xcode-select -p
# /Library/Developer/CommandLineTools
xcrun --find clang
clang --version
xcode-select -p prints the active developer directory. If it prints the path inside Xcode.app instead, you have the full IDE selected and the standalone package is not what your shell is using.
2. Fix “not currently available from the Software Update server”
This error means the on-demand installer asked the Software Update catalog for the package and the catalog did not offer one for your OS build — usually a stale catalog, a proxy or VPN interfering with the request, or a macOS version Apple has stopped serving through that channel.
Work through it in this order:
- Retry the command once. The catalog lookup is flaky and a second attempt often succeeds.
- Disable any VPN, content filter or corporate proxy, then retry.
- Check whether Software Update already knows about the package:
softwareupdate --list
Look for a label of the form Command Line Tools for Xcode-XX.X. If it is listed, install it by copying the label exactly:
sudo softwareupdate -i "Command Line Tools for Xcode-XX.X"
- If nothing is listed, download the standalone package. Sign in at
developer.apple.com/download/allwith a free Apple ID, search for “Command Line Tools”, and pick the build that matches your macOS version. It downloads as a disk image containing a.pkg; open it and run the installer.
Do not install a Command Line Tools package built for a different major macOS version. The headers and linker will not match the SDK your system expects.
3. Skip the package entirely if you have Xcode
If /Applications/Xcode.app exists, the tools are already inside it. Installing the standalone package as well just gives you two copies to keep in sync. Point the system at Xcode instead:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
sudo xcodebuild -runFirstLaunch
-license accept is required before xcodebuild will do anything, and -runFirstLaunch installs the additional components Xcode needs on first run. Both need sudo; xcode-select --install does not.
4. Repair a half-installed or mismatched setup
Symptoms: xcrun: error: invalid active developer path, or clang resolving to a directory that no longer exists (common after deleting Xcode or upgrading macOS).
# what is installed and at which version
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
# reset the selection to the system default
sudo xcode-select --reset
# or set it explicitly
sudo xcode-select --switch /Library/Developer/CommandLineTools
If pkgutil reports nothing, the package is not installed — go back to step 1. If it reports a version but the tools still fail, remove the directory and reinstall cleanly:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
5. Trigger the installer without knowing the command
On a machine with no developer tools, running any tool that macOS knows is developer-supplied will pop the same install dialog:
git --version
This is handy when you are following a setup guide that assumes git exists. It is the same installer as xcode-select --install, just reached from a different direction.
How to prevent it
- After every major macOS upgrade, run
xcode-select --installonce. The package is tied to the OS version and is often removed or invalidated by the upgrade. - Keep the tools current through Software Update rather than reinstalling;
xcode-select --installonly installs, it does not update. - Never add
Xcode.app/Contents/Developer/usr/bintoPATHby hand. Letxcode-selectdecide, or the next Xcode update will break your shell. - Only
xcode-select --switchandxcodebuild -licenseneedsudo. If a guide tells you tosudothe install command, it is wrong. - If you install Homebrew, install the Command Line Tools first — Homebrew checks for them and will fail its own install otherwise.
FAQ
Do I need the full Xcode to install the Command Line Tools?
No. The standalone package is a complete set of compilers, linkers, headers and tools, and it is what most server-side, script and Homebrew workflows need. Install Xcode only when you need the IDE, simulators or xcodebuild.
Where do the Command Line Tools actually get installed?
Into /Library/Developer/CommandLineTools, with the SDK and headers under that tree. xcrun --show-sdk-path prints the SDK the tools are currently using, which is the quickest way to confirm the install is intact.
Why does xcodebuild say it requires Xcode?
Because the active developer directory is a command line tools instance. The message reads xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance. Either install Xcode and switch to it, or use xcrun and the individual tools instead of xcodebuild.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.
