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

BashGitMacosZshMacos Catalina

Bash Problem Overview


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.

Bash Solutions


Solution 1 - Bash

You'll need to reinstall the command line tools:

$ xcode-select --install

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser6269864View Question on Stackoverflow
Solution 1 - BashnaydichevView Answer on Stackoverflow