无法使用 Xcode 10 在 Mojave 上安装 brew

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50780183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:40:42  来源:igfitidea点击:

Cannot install brew on Mojave with Xcode 10

xcodehomebrewmacos-mojave

提问by Weslie

I can not install any brew packages on my mac with the following error info.

我无法使用以下错误信息在我的 mac 上安装任何 brew 包。

Installed on my Mac:

安装在我的 Mac 上:

  • macOS 10.14 Beta (18A293u)
  • Xcode 9.3 (9E145)
  • Xcode 10.0 beta (10L176w)
  • macOS 10.14 测试版 (18A293u)
  • Xcode 9.3 (9E145)
  • Xcode 10.0 测试版 (10L176w)

Type in brew install xxx. The output is:

输入brew install xxx. 输出是:

Error: Your Xcode (9.3) is too outdated.
Please update to Xcode 10.0 (or delete it).
Xcode can be updated from
https://developer.apple.com/download/more/

Error: Xcode alone is not sufficient on Mojave.
Install the Command Line Tools:
xcode-select --install

But as I type in xcode-select --install, it says it is not available
Xcode select install error

但是当我输入时xcode-select --install,它说它不可用
Xcode 选择安装错误

Paths of two versions of Xcode on my Mac:

我的 Mac 上两个版本的 Xcode 的路径:

/Applications/Xcode-beta.app
/Applications/Xcode.app

And my config output:
xcode-select -p

还有我的配置输出:
xcode-select -p

/Applications/Xcode.app/Contents/Developer     

brew config

酿造配置

HOMEBREW_VERSION: 1.6.7
ORIGIN: https://github.com/Homebrew/brew
HEAD: 22e9fd772926e389e264cfb328c3d810b06759f9
Last commit: 5 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 854bb90b366169915849fc9a83e941b8883cea1f
Core tap last commit: 6 hours ago
HOMEBREW_PREFIX: /usr/local
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.6 =>./System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.1 build 902
Git: 2.15.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_131
macOS: 10.14-x86_64
CLT: N/A
Xcode: 9.3
XQuartz: N/A

回答by joseph

You will need to install both "Xcode 10.0 Beta" from https://developer.apple.com/download/AND"Command Line Tools (macOS 10.14) for Xcode 10 Beta" from

您将需要安装“ Xcode的10.0测试版从” https://developer.apple.com/download/命令行工具(MacOS的10.14)的Xcode的10测试版”,从

https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_macOS_10.14_for_Xcode_10/Command_Line_Tools_macOS_10.14_for_Xcode_10.dmg

https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_macOS_10.14_for_Xcode_10/Command_Line_Tools_macOS_10.14_for_Xcode_10.dmg

Update contributed by other comments, after you installed "Command Line Tools", you will also need to execute the following command in your terminal.

由其他评论贡献的更新,安装“命令行工具”后,您还需要在终端中执行以下命令。

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

回答by craig65535

Beginning in 10.14, a new step is required to create the header files in /usr/include:

从 10.14 开始,需要一个新步骤来在 /usr/include 中创建头文件:

Install /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

安装 /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Source: The Xcode 10 release notes

来源:Xcode 10 发行说明

回答by Irvin Chen

After installing CLT, you can ask CLT to add header files to /usr/include, then homebrew will appropriate detect the Command Line Tools.

安装 CLT 后,您可以要求 CLT 添加头文件到/usr/include.homebrew 将适当地检测命令行工具。

installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

回答by Dennis Liu

After installing Xcode 10 Betaand Command Line Tools (macOS 10.14) for Xcode 10 Beta, I also changed the path for xcode-selectto use the newly installed command line tools with:

在为Xcode 10 Beta安装Xcode 10 Beta命令行工具 (macOS 10.14) 后,我还更改了xcode-select的路径以使用新安装的命令行工具:

sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer     

回答by Mark Han

At this time, Brew is not supporting macOS Mojave Beta.

目前,Brew 不支持 macOS Mojave Beta。

(Type brew doctorto confirm that they are not accepting issues for Mojave yet)

(输入brew doctor以确认他们尚未接受 Mojave 的问题)

See: https://apple.stackexchange.com/questions/327458/install-homebrew-packages-on-macos-mojave-beta

请参阅:https: //apple.stackexchange.com/questions/327458/install-homebrew-packages-on-macos-mojave-beta

See: https://github.com/Homebrew/brew/issues/4295

见:https: //github.com/Homebrew/brew/issues/4295

回答by overtfuture

I was able to install Homebrew on Mojave by manually downloading the command line tools here: https://developer.apple.com/download/more/

通过在此处手动下载命令行工具,我能够在 Mojave 上安装 Homebrew:https: //developer.apple.com/download/more/

Modify the Homebrew install script here: https://raw.githubusercontent.com/Homebrew/install/master/install

在此处修改 Homebrew 安装脚本:https: //raw.githubusercontent.com/Homebrew/install/master/install

By replacing:

通过替换:

def should_install_command_line_tools?
  return false if force_curl?
  return false if macos_version < "10.9"
  !File.exist?("/Library/Developer/CommandLineTools/usr/bin/git") ||
  !File.exist?("/usr/include/iconv.h")
end

With this:

有了这个:

def should_install_command_line_tools?
  return true
end

Then just execute the script.

然后只需执行脚本。

This is a little hacky, but it worked for me and could help someone out in the beta period.

这有点 hacky,但它对我有用,并且可以在测试期间帮助某人。

回答by Irvin Chen

confirm that Command Line Tools for 10.14 won't create /usr/include/folder that makes brew install script insist to re-download and install CL.

确认 10.14 的命令行工具不会创建/usr/include/使 brew install 脚本坚持重新下载和安装 CL 的文件夹。

download the script, and manual removing checking works fine. (be aware it should be falseinstead of true.

下载脚本,手动删除检查工作正常。(注意它应该是false而不是true

def should_install_command_line_tools?
  return **false**
end