Reputation: 69
While trying to install Homebrew on macOS Sierra:
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
Upvotes: 5
Views: 24014
Reputation: 44
Also faced this error on Sonoma 14.1.2 (23B92) and get rid of by following approach
After this home-brew easily installed
Upvotes: 0
Reputation: 10994
I tried installing Command Line Tools manually, but Command Line Tools get failed while installing. Reinstalling XCode did not help at all.
So I attempted below command helped me resolve this error on Big Sur 11.2.1 (20D74)
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Upvotes: 1
Reputation: 470
Yes , i have solved this error by using following steps.
Upvotes: 10
Reputation: 629
The easiest way to handle this issue is to run:
xcode-select --install
Upvotes: 1
Reputation: 61
I had the same error and the only way I could get around it was to install the Xcode command line tools manually by downloading them directly from developer.apple.com. Once installed the brew install worked without issue.
Upvotes: 4
Reputation: 69
I resolved this error by installing the latest version of Xcode.
Upvotes: 1
Reputation: 41
Unfortunately I can’t make comments, so I’ll post it as an answer:
If selecting the correct Xcode version for Homebrew is what you are trying to achieve, then try this:
For Xcode release:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
For Xcode beta:
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
Upvotes: 0