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

时间:2018-06-10 02:54:22

标签: xcode homebrew macos-mojave

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

安装在我的Mac上:

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

输入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

但是当我输入xcode-select --install时,它说它不可用 Xcode select install error

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

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

我的配置输出:
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

7 个答案:

答案 0 :(得分:24)

您需要在https://developer.apple.com/download/ 命令行工具(macOS 10.14)中为Xcode 10 Beta安装” Xcode 10.0 Beta “来自

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

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

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

答案 1 :(得分:20)

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

安装$`par` [1] 400 $value [1] -1581 $counts function gradient 2 2 $convergence [1] 0 $message NULL

来源:The Xcode 10 release notes

答案 2 :(得分:9)

在安装CLT之后,您可以要求CLT将头文件添加到/usr/include,然后自制程序将适当地检测命令行工具。

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

答案 3 :(得分:3)

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

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

答案 4 :(得分:1)

此时,Brew不支持macOS Mojave Beta。

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

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

请参阅:https://github.com/Homebrew/brew/issues/4295

答案 5 :(得分:0)

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

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

替换:

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

有了这个:

def should_install_command_line_tools?
  return true
end

然后只需执行脚本。

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

答案 6 :(得分:-2)

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

下载脚本,手动删除检查效果很好。 (请注意,它应该为 false 而不是 true

def should_install_command_line_tools?
  return **false**
end