Skip to main content
macOSbeginner

"xcrun: error: invalid active developer path" Fix

Fix "xcrun: error: invalid active developer path" on macOS. Reinstall the Command Line Tools with xcode-select --install, repoint a broken developer directory, and verify git works again.

6 min readUpdated August 2026

Running git or make after a macOS update and getting "xcrun: error: invalid active developer path"? The Command Line Tools are missing or the pointer to them is stale. One command usually fixes it.

The Error

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

The same error appears from gcc, clang, make, swift and anything else that routes through the developer toolchain.


Quick Fix

xcode-select --install

A dialog appears asking whether you want to install the command line developer tools. Click Install, accept the licence, and wait for it to finish. Then try your original command again.

That resolves the large majority of cases.


Why This Happens

macOS keeps a pointer to the active developer directory - the location of the toolchain that xcrun should use. You can see it with xcode-select -p.

A macOS upgrade frequently removes or replaces /Library/Developer/CommandLineTools without clearing that pointer. The result is a path that is still recorded as active but no longer contains xcrun, which is precisely what the error says.

This explains the symptom that confuses people most: git breaking overnight when no project changed. /usr/bin/git is not really git - it is a small shim that defers to xcrun to locate the real binary inside the active developer directory. Break the toolchain and every shim breaks together, which is why git, clang and make all fail at the same moment.


Fix 1: Reinstall the Command Line Tools

xcode-select --install

If the tools are genuinely absent, this downloads and installs them.

If it responds:

xcode-select: error: command line tools are already installed,
use "Software Update" to install updates

then the package is present but the pointer is wrong. Continue to fix 2.


Fix 2: Reset the Active Developer Path

Return the pointer to its default:

sudo xcode-select --reset

Or set it explicitly:

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

Check the result:

xcode-select -p
git --version

Fix 3: Point at Xcode Instead

If you have the full Xcode application installed, point the toolchain at it:

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

The licence step matters. An unaccepted licence produces a different but equally blocking error (Agreeing to the Xcode/iOS license requires admin privileges), and accepting it up front avoids a second round trip.

You do not need Xcode for general development. The Command Line Tools package is a few hundred megabytes and includes git, clang, make and the standard headers. Full Xcode runs to many gigabytes and is only necessary for building iOS and macOS applications.


Advertisement

Fix 4: Remove and Reinstall a Corrupt Toolchain

If the directory exists but is incomplete - a common outcome of an interrupted install - remove it and start again:

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

Check what you are about to delete first:

ls -la /Library/Developer/CommandLineTools

This path contains only Apple-supplied tooling. It holds none of your own work, so removing it is safe, but as with any recursive sudo rm it is worth reading the path twice before pressing Return.


Fix 5: When the Installer Refuses

Occasionally the GUI installer fails with:

Can't install the software because it is not currently available
from the Software Update server.

This means Apple's update catalogue and your macOS build are briefly out of step. Rather than retrying indefinitely, download the package directly:

  1. Go to the Apple Developer downloads site and sign in with any free Apple ID.
  2. Search for Command Line Tools for Xcode and choose the version matching your macOS release.
  3. Download the .dmg and run the installer inside it.

Verify the Fix

# Where the toolchain now points
xcode-select -p

# The tools themselves
git --version
clang --version
xcrun --find git

Expected output:

/Library/Developer/CommandLineTools
git version 2.39.5 (Apple Git-154)
Apple clang version 15.0.0 (clang-1500.3.9.4)
/Library/Developer/CommandLineTools/usr/bin/git

xcrun --find git is the most direct confirmation: it exercises exactly the lookup that was failing.


Prevention

  • Expect this after every major macOS upgrade. Running xcode-select --install as part of your post-upgrade routine turns a confusing morning into a two-minute task.
  • Keep a note of whether your machine uses the standalone Command Line Tools or full Xcode. Mixed expectations are the usual reason a fix that worked on one Mac does nothing on another.
  • If you manage Macs for a team, push the Command Line Tools through MDM after an OS upgrade rather than waiting for individual reports of broken git.
  • Homebrew depends on this toolchain. If brew install starts failing with compiler errors after an upgrade, check xcode-select -p before investigating the formula.

Summary

  1. First: xcode-select --install
  2. Already installed: sudo xcode-select --reset
  3. Have Xcode: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer then sudo xcodebuild -license accept
  4. Corrupt: sudo rm -rf /Library/Developer/CommandLineTools then reinstall
  5. Verify: xcode-select -p and xcrun --find git

Frequently Asked Questions

Find answers to common questions

The path macOS has recorded as the active developer directory no longer contains a working toolchain. This is almost always the aftermath of a macOS upgrade, which can remove or invalidate the Command Line Tools while leaving the pointer to them in place.

The git binary at /usr/bin/git is a small shim that hands off to xcrun. When the toolchain behind xcrun is missing, the shim fails and prints this error - so git, gcc, make, clang and similar commands all break at once even though nothing about your project changed.

Run 'xcode-select --install' and accept the prompt. It downloads the Command Line Tools package, typically a few hundred megabytes, and restores the toolchain. Most people need nothing else.

The pointer is stale rather than the package missing. Run 'sudo xcode-select --reset' to return to the default location, then test again. If that fails, remove /Library/Developer/CommandLineTools and reinstall.

No. The Command Line Tools package is a few hundred megabytes and provides git, clang, make and the headers most development work needs. Full Xcode is many gigabytes and is only required for building iOS and macOS applications.

The active developer directory may still point at a Command Line Tools path that no longer exists. Point it at Xcode explicitly with 'sudo xcode-select -s /Applications/Xcode.app/Contents/Developer', then run 'sudo xcodebuild -license accept'.

This happens when Apple's catalogue and your macOS version are briefly out of step. Download the Command Line Tools package manually from the Apple Developer downloads site, signing in with any free Apple ID, and install the .dmg directly.

Run 'xcode-select -p'. On a healthy system with only the Command Line Tools it prints /Library/Developer/CommandLineTools. With Xcode selected it prints a path inside /Applications/Xcode.app.

No. It replaces a system toolchain directory and does not touch your repositories, dependencies or configuration. Homebrew packages already installed continue to work, though some may need rebuilding if they were compiled against removed headers.

Usually five to fifteen minutes depending on your connection. The progress window can appear stalled at "Finding Software" for a minute or two before the download starts, which is normal.