Git doesn't work on MacOS Catalina: "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing"

user6269864 picture user6269864 · Oct 8, 2019 · Viewed 64.7k times · Source

After upgrading to MacOS X 10.15 Catalina, I cannot run any git commands in my shell:

The default interactive shell is now zsh.

To update your account to use zsh, please run chsh -s /bin/zsh.

For more details, please visit https://support.apple.com/kb/HT208050.

~ | git

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

I thought there's a problem with my shell, so I followed the instructions to change the default Mac OS shell back to bash, using the GUI and also using the command line:

chsh -s /bin/bash

I also restarted the computer. However, I still see the same message, even though echo "$SHELL" outputs /bin/bash.

Answer

naydichev picture naydichev · Oct 8, 2019

You'll need to reinstall the command line tools:

$ xcode-select --install