wenyc
wenyc

Reputation: 263

error: unable to find utility "git", not a developer tool or in PATH

I have updated Xcode version to 7.3.1.when I use 'git status',I find an error! as follow:

$git status
sh: line 1:  1601 Segmentation fault: 11  /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find git 2> /dev/null
git: error: unable to find utility "git", not a developer tool or in PATH

Thank you advanced!

Upvotes: 23

Views: 25735

Answers (6)

K M Rakibul Islam
K M Rakibul Islam

Reputation: 34308

I had the same issue after upgrading to Big Sur. I fixed this issue by running the following command:

sudo xcode-select -switch /Library/Developer/CommandLineTools

P.S. I did not need to run this command: xcode-select --install

Upvotes: 2

Jose
Jose

Reputation: 2279

None of the above solutions fixed the issue for me, I had to actually just restart my computer which fixed it. This was a weird bug.

Upvotes: 0

Nick Grealy
Nick Grealy

Reputation: 25854

For me, I had to uninstall and reinstall all my brew applications, as documented here.

i.e.

brew list -1 > brew.txt # list out all installed packages
brew list -1 | xargs brew rm --force # remove all installed packages
brew install $(cat brew.txt | tr '\n' ' ') # install all previously installed packages

Upvotes: 0

Gedas Kutka
Gedas Kutka

Reputation: 1316

This happened to me also with upgrading to High Sierra and XCode to 9. This sequence has fixed it.

xcode-select --install
sudo xcode-select -s /Library/Developer/CommandLineTools

Found this answer on https://davidwalsh.name/fix-git-high-sierra-upgrade (article and comments.)

Upvotes: 97

RhinoDavid
RhinoDavid

Reputation: 794

I had this same problem -- I exited my bash session (closed the terminal) and started a new one and it fixed it.

Upvotes: 57

yorammi
yorammi

Reputation: 6458

The best solution will be to download and install it - even that you assume it is already installed: https://git-scm.com/download/mac

Upvotes: 6

Related Questions