git cannot be used after uninstalling xcode on mac

created at 03-31-2022 views: 4

problem

After xcode is uninstalled, the following situation occurs: the git command fails, and the following error is reported:

xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun

analysis

It must be that xcode comes with git, which makes it unusable after deletion, so you need to modify the original git path or reinstall git

Reinstall git as follows, No response

MacBook-Pro:~ zhengjie$ brew install git
Error: git: Unsupported special dependency :perl
Error: Git must be installed and in your PATH!
Error: git: Unsupported special dependency :perl

Using the update brew update is also useless, the following error is reported:

Error: git: Unsupported special dependency :perl
Error: Git must be installed and in your PATH!

Then toss and install brew install perl, but git still can't be installed

solution:

Mainly reset the settings of the previous xcode

Note: If there is no installation, you need to perform the installation (my mac is already installed) xcode-select --install

The three-step command reset -> modify the path point -> print the path path The details are as follows:

sudo xcode-select -r
sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
xcode-select -p

Test git command:

MacBook-Pro:~ zhengjie$ git --version
git version 2.20.1 (Apple Git-117)

OK, we can use git again.

Please log in to leave a comment.