After upgrade to Big Sur git stopped working

After upgrade to Big Sur git stopped working and it keeps prompting to install CLT. According to Xcode-select, see output below CLT is already installed:

sbezverk@sbezverk-mac-2 ~ % sudo xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

sbezverk@sbezverk-mac-2 ~ % git

sh: line 1:   772 Bus error: 10           /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx -find git 2> /dev/null

git: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx -find git 2> /dev/null' failed with exit code 35328: (null) (errno=No such file or directory)

xcode-select: Failed to locate 'git', requesting installation of command line developer tools.

Any help to solve this issue would be great.
I was having the same issue.
I managed to get it fixed by running

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


56
Thanks! I had the same problem and it solved the problem.
Thanks mclngl !
Same here. However, got another error when run the xcode-select

Code Block
MBP$ sudo xcode-select -switch /Library/Developer/CommandLineTools
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'


Do I need to reinstall the xcode after upgrade to Big Sur?


Thanks @mcingi and I think I think it is better to up vote the correct answer as this makes it easy for other people to find.
For those experiencing problem after running

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

Try downloading the Xcode command line tools from -> Apple Developers Command line tools and repeat the xcode-select command above. All the best !

Hit the same issue, needed to upgrade the command line tools version prior to running the xcode-select command.
All worked fine afterwards.
I am having the same issue over and over again...
I will solve the "Git not found" error with @mcingi and @juniorme answers then it will work fine until one day Git is missing again...
Am I the only one who is having this problem repeatedly? This is the 3rd time it went missing on my MacBook Pro.
git and command line tools disappear every time I update Big Sur. Very annoying! And running

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

results in error.
Me too on three different machines - every time I update Big Sur it requires a reinstall.
Yeah it borked itself right before a lecture this time - just goes totally missing whenever I update the OS

every time I update Big Sur it requires a reinstall

Well, that’s annoying. Did you file a bug about that? If so, what’s the bug number?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
I get this too on BigSur - so annoying, I recently switched to MAC from Windows and I'm really dissapointed on the number of bugs I hit. I get random restarts(aka blue screen) every couple of days, so many features just don't work it's unbelievable.
Happened again after update to 11.2.3.
Happens every time I update big sur as well. And yes, it happened with 12.2.3
Same. Happens every time I update the OS. Major pain.
Same issue. Literally every time I run a Big Sur update, the xcode command line tools are gone after the update.

What even is going on?
Has anyone filed a bug about this (per my request a few weeks back)? If so, what was the bug number?

I ran this past DTS’s tools specialist and it’s not something we’re tracking. A bug number might let me find more info.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Has anyone filed a bug about this …?

It turns out that, while no one posted a bug number here, lots of folks have file a bug about this (r. 73410925). This is clearly a real problem but, alas, I have no info to share as to when it’ll be resolved.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Same here, after every update on Big Sur I need to run xcode-select --install to reinstall the command line tools. Feels like this really shouldn't be an issue. It's quite annoying.
@eskimo,

Yes, I updated to Big Sur and I got the same issue. I have raised FB9077129 for your kind reference.

Even after installing the command line tools for xcode-beta13 I get the following error when trying to install wireshark development code in my system after updating to BigSur.

bash-3.2$ wireshark/tools/macos-setup.sh macos-setup.sh: Couldn't find an SDK for macOS 11.4 or later bash-3.2$ sudo xcode-select -switch /Library/Developer/CommandLineTools bash-3.2$ cd wireshark bash-3.2$ tools/macos-setup.sh macos-setup.sh: Couldn't find an SDK for macOS 11.4 or later bash-3.2$

Also when I do cmake to setup the wireshark development environment I get the following error

bash-3.2$ cmake ../wireshark -- Generating build using CMake 3.19.2 -- LTO/IPO is not enabled -- CMake build type: RelWithDebInfo -- V: 3.5.0, MaV: 3, MiV: 5, PL: 0, EV: . -- Linker flags: -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'glib-2.0' CMake Error at /Users/mmunuswamy/Qt/Tools/CMake/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message): Could NOT find GLIB2 (missing: GLIB2_LIBRARY GLIB2_MAIN_INCLUDE_DIR GLIB2_INTERNAL_INCLUDE_DIR) (Required is at least version "2.38.0") Call Stack (most recent call first): /Users/mmunuswamy/Qt/Tools/CMake/CMake.app/Contents/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE) cmake/modules/FindGLIB2.cmake:111 (find_package_handle_standard_args) CMakeLists.txt:1113 (find_package)

-- Configuring incomplete, errors occurred! See also "/Users/mmunuswamy/work/wireshark/build/CMakeFiles/CMakeOutput.log". See also "/Users/mmunuswamy/work/wireshark/build/CMakeFiles/CMakeError.log". bash-3.2$

Any help is greatly appreciated. Thanks in advance

trying to run 'instruments' and I constantly get asked to install Command Line Tools, even though its already installed. Xcode 13.0 and have CLT selected in the Prefs menu. Very frustrating! 

EDIT: Only think that I've found that works is to use an older version of CLT, Xcode 13.0 but selecting Xcode 10 for CLT in the Prefs. It gives an error, but at least it works. Pretty shoddy from Apple that so many people are having this issue, there are at least 3 Stack Overflow questions about this.

CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode_10.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo' instruments, version 10.0 (64293.19)

install manually from this link https://developer.apple.com/download/all/?q=command%20line%20tools solved my problem

Thanks, mclngl! Saved me a bunch of time. Sad that this is still broken, one year later.

guys this fixed the issue for me -->. sudo xcode-select --switch /Library/Developer/CommandLineTools

After upgrade to Big Sur git stopped working
 
 
Q