Background
After upgrading the MAC system, using git clone and other related commands on the terminal fails with an error
xcrun:error:invalid active developer path(/Library/Developer/CommandLineTools),missing xcrun at:/Library/Developer/CommandLineTools/usr/bin/xcrun
Troubleshooting
1. Check whether git has been installed
# command
which git
# outcome
/usr/local/bin/git
Description git has been installed
2. View git help information
git --help
Error reporting is the same as above:
xcrun:error:invalid active developer path(/Library/Developer/CommandLineTools),missing xcrun at:/Library/Developer/CommandLineTools/usr/bin/xcrun
to sum up, GIT has been installed, but the GIT command cannot be used normally. It may be that the GIT installation package is damaged, so reinstall git
3. Reinstall Git
brew install git
The following error messages appear during installation:
Error: The following formula:
git
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install
Error: Git must be installed and in your PATH!
Error: The following formula:
git
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install
according to the prompt, you need to reinstall xcode-select
Solution: install xcode-select
To sum up, we need to reinstall xcode-select and execute the following commands on the terminal
xcode-select --install
After installation, perform the following:
git --help
The correct output of information indicates that git has returned to normal and can be used