简体   繁体   English

尝试在 macOS Sierra 上安装 Homebrew 时出现 xcode-select 错误

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

While trying to install Homebrew on macOS Sierra:尝试在 macOS Sierra 上安装 Homebrew 时:

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.我遇到了同样的错误,解决它的唯一方法是通过直接从 developer.apple.com 下载来手动安装 Xcode 命令行工具。 Once installed the brew install worked without issue.安装后,brew install 可以正常工作。

Yes , i have solved this error by using following steps.是的,我已经使用以下步骤解决了这个错误。

  1. In your terminal write command :: xcode-select --install在你的终端写命令 :: xcode-select --install
  2. after doing step no 1 you will get one popUp , so click on install执行第 1 步后,您将获得一个弹出窗口,因此单击安装

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:如果您正在尝试为 Homebrew 选择正确的 Xcode 版本,请尝试以下操作:

For Xcode release:对于 Xcode 版本:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

For Xcode beta:对于 Xcode 测试版:

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我在 macOS catalina 中解决了同样的问题,只需更新 macOS

For updating macOS Watch用于更新 macOS Watch

I tried installing Command Line Tools manually, but Command Line Tools get failed while installing.我尝试手动安装命令行工具,但命令行工具在安装时失败。 Reinstalling XCode did not help at all.重新安装 XCode 根本没有帮助。

So I attempted below command helped me resolve this error on Big Sur 11.2.1 (20D74)所以我尝试了下面的命令帮助我解决了 Big Sur 11.2.1 (20D74) 上的这个错误

sudo rm -rf /Library/Developer/CommandLineTools sudo rm -rf /Library/Developer/CommandLineTools

sudo xcode-select --install须藤 xcode-select --install

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh )" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh )"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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