If you see this error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

Run this command:

xcode-select --install

Click "Install" in the dialog that appears. Wait for the download and installation to complete.

That's it. The error should be gone.

Why This Happens

This error appears after:

  • Upgrading macOS: Major updates often clear the Xcode Command Line Tools
  • Updating Xcode: Sometimes breaks the tools symlinks
  • Deleting Xcode: Removes the developer path

The error means macOS can't find the developer tools that commands like git, make, gcc, and others depend on.

What Gets Installed

Xcode Command Line Tools includes:

  • Git
  • Make
  • GCC/Clang compilers
  • Python
  • Various Unix utilities

You don't need the full Xcode app (which is several GB). The command line tools are much smaller (~1GB) and sufficient for most development work.

If xcode-select --install Doesn't Work

The dialog doesn't appear

Try resetting the path first:

sudo xcode-select --reset
xcode-select --install

"Can't install the software because it is not currently available"

Download directly from Apple:

  1. Go to developer.apple.com/download/more
  2. Sign in with your Apple ID
  3. Search for "Command Line Tools"
  4. Download the version matching your macOS
  5. Run the installer

Xcode is installed but still getting the error

Point to Xcode's developer directory:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Or switch back to command line tools:

sudo xcode-select --switch /Library/Developer/CommandLineTools

Check the Installation

After installing:

xcode-select -p

Should output: /Library/Developer/CommandLineTools

And:

git --version

Should show a version number instead of the error.

Related Errors

These errors usually have the same fix:

  • xcrun: error: active developer path does not exist
  • xcode-select: error: command line tools are already installed
  • gyp: No Xcode or CLT version detected

Run xcode-select --install for all of them.

After a macOS Upgrade

Make it a habit: after upgrading macOS, run:

xcode-select --install

Even if you don't see an error yet. This prevents issues when you need the tools later.

Full Reset

If you're still having trouble, completely remove and reinstall:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Homebrew Users

If you installed Homebrew and it complains about developer tools:

xcode-select --install
brew doctor

brew doctor will tell you if there are remaining issues.


Keep Learning

The Xcode Command Line Tools are essential for development on Mac. The free course covers Terminal fundamentals.

Check it out at Mac Terminal for Humans.