Home › Git

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun (Git) — how to fix

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Quick fix: Reinstall the Command Line Tools: xcode-select --install and accept the dialog. If it says they're already installed, reset them: sudo rm -rf /Library/Developer/CommandLineTools && xcode-select --install. If you have full Xcode, point to it instead: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.

What it means

On macOS, /usr/bin/git, /usr/bin/make, /usr/bin/clang, /usr/bin/python3 and friends are small stubs. They ask xcrun to find the real tool in the active developer directory — either the Command Line Tools (/Library/Developer/CommandLineTools) or Xcode. If that directory is missing or incomplete, you get this error from every tool.

It almost always appears right after a major macOS upgrade (the installer removes or invalidates the Command Line Tools), or on a fresh Mac. Your repositories are fine; only the tools are missing.

Check the current setting:

xcode-select -p

Fix 1: install the Command Line Tools

xcode-select --install

A dialog appears; click Install and accept the licence. It downloads a few hundred MB. Afterwards:

git --version

Fix 2: "command line tools are already installed"

If xcode-select --install says they're installed but the error persists, the install is broken. Remove and reinstall:

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

If the dialog doesn't appear or the download fails ("not currently available from the Software Update server"), download Command Line Tools for Xcode for your macOS version from developer.apple.com/download/all (free Apple ID needed) and run the .pkg. Or use Software Update:

softwareupdate --list
softwareupdate --install "Command Line Tools for Xcode-16.0"   # use the exact label from --list

Fix 3: you have full Xcode installed

Point the active developer directory at Xcode instead:

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

If you previously pointed to Xcode and then deleted or renamed it (e.g. Xcode-beta.app), reset to the default:

sudo xcode-select --reset

Fix 4: use Homebrew's git (doesn't remove the need for CLT)

brew install git gives you a git that doesn't go through the /usr/bin stub, and makes sure your PATH puts /opt/homebrew/bin (Apple Silicon) or /usr/local/bin (Intel) first. Note that Homebrew itself requires the Command Line Tools, so do Fix 1 anyway.

IDEs and GUI apps

VS Code, JetBrains IDEs, SourceTree and GitHub Desktop that use the system git show the same error, often as "git not found" or "xcrun: error". Fix it in Terminal with the steps above, then restart the app.

Last updated 2026-11-09.