I've been checking this problem and I'll try to share all the options so you can have everything in a single message:
If you don't need Xcode, Removing it will solve the issue.
But in case you need Xcode you can try:
sudo rm -rf /Library/Developer/CommandLineTools
. Remove CommandLineTools.
sudo xcode-select -r
. This ensures that the system knows where to find the developer tools.
- Then
xcode-select --install
(Reinstall it)
- If this doesn't fix it. Try:
sudo xcode-select --switch /Applications/Xcode.app/
Another option is a mismatch between Command Line Tools and Xcode versions
➜ ✗ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 15.3.0.0.1.1708646388
volume: /
location: /
install-time: 1728515565
➜ ✗ xcodebuild -version
Xcode 16.0
Build version 16A242d
After checking this I went to https://developer.apple.com/download/all/?q=Command%20Line and downloaded Command Line Tools for Xcode 16
version.
After that:
➜ ✗ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 16.0.0.0.1.1724870825
volume: /
location: /
install-time: 1728518012
➜ ✗ xcodebuild -version
Xcode 16.0
Build version 16A242d
and after you can try updating the go version
brew update
brew upgrade go
go version
> go version go1.23.2 darwin/arm64
I'm not sure if updating go only might work but I'm sharing all the attempts so you can try everything until you make it work.