vina shinde
vina shinde

Reputation: 69

xcode-select error while trying to install Homebrew on macOS Sierra

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

Answers (7)

Aqib Hussain CH
Aqib Hussain CH

Reputation: 44

Also faced this error on Sonoma 14.1.2 (23B92) and get rid of by following approach

  1. In Mac terminal add : xcode-select --install
  2. After it a prompt message shown, click on install

After this home-brew easily installed

Upvotes: 0

Long Nguyen
Long Nguyen

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

Zalak Parikh
Zalak Parikh

Reputation: 470

Yes , i have solved this error by using following steps.

  1. In your terminal write command ::  xcode-select --install
  2. after doing step no 1 you will get one popUp , so click on install

Upvotes: 10

herbertug
herbertug

Reputation: 629

The easiest way to handle this issue is to run: xcode-select --install

Upvotes: 1

ngar
ngar

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

vina shinde
vina shinde

Reputation: 69

I resolved this error by installing the latest version of Xcode.

Upvotes: 1

Tom
Tom

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

Related Questions