【问题标题】:xcode-select error while trying to install Homebrew on macOS Sierra尝试在 macOS Sierra 上安装 Homebrew 时出现 xcode-select 错误
【发布时间】:2017-05-03 11:25:34
【问题描述】:
尝试在 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
【问题讨论】:
标签:
macos
installation
homebrew
【解决方案1】:
我遇到了同样的错误,我可以绕过它的唯一方法是手动安装 Xcode 命令行工具,方法是直接从 developer.apple.com 下载它们。安装后,brew install 可以正常工作。
【解决方案2】:
是的,我已经通过以下步骤解决了这个错误。
- 在终端写入命令 :: xcode-select --install
- 执行第 1 步后,您将获得一个弹出窗口,因此请点击安装
【解决方案3】:
处理此问题的最简单方法是运行:
xcode-select --install
【解决方案4】:
很遗憾我不会做cmets,所以我会发布它作为答案:
如果您想要为 Homebrew 选择正确的 Xcode 版本,请尝试以下操作:
对于 Xcode 版本:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
对于 Xcode 测试版:
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
【解决方案5】:
我通过安装最新版本的 Xcode 解决了这个错误。
【解决方案7】:
我在 macOS catalina 中解决了同样的问题,只需 更新 macOS
用于更新 macOS Watch