简体   繁体   中英

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

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.

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

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

我通过安装最新版本的 Xcode 解决了这个错误。

处理这个问题最简单的方法是运行: xcode-select --install

I have solved same issue in macOS catalina simply update macOS

For updating macOS Watch

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 )"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM