Git on macOS, xcrun: error: invalid active developer path

After upgrading to macOS Big Sur 11, macOS Monterey 12, macOS Ventura 13, etc. Does it seem every upgrading macOS will cause the following error message for the git command? How to fix it?

Terminal

% git

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

Solution

Open the Terminal, and run this

Terminal

    xcode-select --install  

The above command will install the command line developer tools.

Follow the GUI guide and proceed with the installation; this should fix the git xcrun error.

install command line developer tools

If the above is not working, try the below command.

Terminal

    sudo xcode-select --reset

References

mkyong

Founder of Mkyong.com, passionate Java and open-source technologies. If you enjoy my tutorials, consider making a donation to these charities.

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments