Fix Git not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
Some Mac Terminal users may discover git, pip, HomeBrew, and other command line tools may fail or not work as intended with an error message stating “xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)”. Sometimes these command line tools stop working after a macOS system software update, but they worked previously.
Fortunately it’s easy to fix the “xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)” error message, and get git, pip, Homebrew, or whatever other command line tool that failed, to start working again.
For what it’s worth, the full error message is:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Fix “xcrun: error: invalid active developer path” Error in Terminal on MacOS
The solution, as you may have guessed from the error message itself, is to reinstall or install Command Line Tools. Yes, even if you already have command line tools installed, you should reinstall it to resolve the error message, particularly if you are only experiencing the error after a system software update (eg, from Mojave to Monterey).
Installing/reinstalling CLT can be done from the command line by issuing the following command string in Terminal:
xcode-select --install
Hitting return will cause a pop-up to appear with a progress indicator on the download for Command Line Tools.
Once the installation of Command Line Tools has completed, you should reboot the Mac (sometimes simply refreshing, relaunching Terminal, or opening a new Terminal may resolve the ‘xcrun error invalid active developer path’ message too, but a reboot is recommended).
If you are using Homebrew, you should also be sure to update Homebrew after you have (re)installed Command Line Tools.
Still seeing xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)?
If you installed or reinstalled command line tools through Terminal, rebooted the Mac, and you’re still getting the error, you can also try to manually install Command Line Tools by using a DMG file directly from Apple.
You will need an Apple ID to access the download, then just head to developer.apple.com and download Command Line Tools for Xcode (latest version) and install it manually.
Again, Homebrew users will want to update Homebrew. You should not have to install Homebrew again or remove it and then reinstall it, a simple update should do the trick.
Git is not working after updating MacOS because of xcrun error?
If you discover that Git is no longer working after installing a MacOS system software update, first try to install xcode Command Line Tools:
Check System Settings / Preferences > General > Software Update to see if any updates to Command Line Tools are shown.
You can also reinstall Xcode Command Line Tools through Terminal:
xcode-select --install
Command Line Tools often needs to update after installing a MacOS system update.
You also may need to agree to the Xcode license again after installing an update before it will work again.
sudo xcodebuild --license
Did this work to resolve your issues with git, pip, Homebrew, or whatever was triggering the xcrun error message at the command line on your Mac? Did you find another solution? Share your thoughts and experiences in the comments.
Thank you, this resolved my issue with git
If you don’t feel like downloading 15GB of stuff, this has fixed the issue for me:
sudo xcode-select –reset
Reinstalling CTL and relaunching it solved the issue for me. Thank you very much!
For me as well
Tks! That solved my problem
Thank you very much! This was clear and very helpful.