Search code examples
command-line-toolxcode-command-line-tools

xcode command line tools not able to locate git


On Big Sur, I had XCode CLT installed, but not xcode itself. Git was working fine. Then I installed XCode and now when I try to run git I get the following message:

git: error: Failed to determine realpath of '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk' (errno=No such file or directory)
git: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -find git 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)
xcode-select: Failed to locate 'git', requesting installation of command line developer tools.

A popup comes up, asks to install CLT and when I say ok, it downloads and installs for a few minutes. But when it's done, I'm right back where I started.
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk does not exist, but there are directories for 10.15, 11.1 and 11.3. But not 10.14.


Solution

  • Run the command:

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