【问题标题】:Cannot install brew on Mojave with Xcode 10无法使用 Xcode 10 在 Mojave 上安装 brew
【发布时间】:2018-06-10 02:54:22
【问题描述】:

我无法在我的 Mac 上安装任何 brew 包,并显示以下错误信息。

安装在我的 Mac 上:

  • macOS 10.14 测试版 (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     

酿造配置

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

【问题讨论】:

  • 投了赞成票,因为问得很好,但也投了赞成票,因为这应该在 AskDifferent 或 SuperUser 上提出。
  • 今天早些时候遇到了同样的问题。通过从 developer.apple.com 下载 CL 工具并同时运行 CLTools_SDK 和 CLTools_Executables 即可解决。

标签: xcode homebrew macos-mojave


【解决方案1】:

您需要从https://developer.apple.com/download/ 安装“Xcode 10.0 BetaXcode 10 Beta 的命令行工具 (macOS 10.14)强>”来自

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

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

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

【讨论】:

  • 我正在使用 Xcode 10.0 beta 3(在 macOS 10.14 上)并且没有适用于 beta 3 版本的命令行工具。
【解决方案2】:

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

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

来源:The Xcode 10 release notes

【讨论】:

  • 就是这样。干杯
【解决方案3】:

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

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

【讨论】:

    【解决方案4】:

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

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

    【讨论】:

      【解决方案5】:

      目前,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

      【讨论】:

        【解决方案6】:

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

        在此处修改 Homebrew 安装脚本: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,但它对我有用,并且可以在测试阶段帮助某人。

        【讨论】:

        • 我没有尝试黑客的方式,但安装 CLTools 工作。非常感谢。不幸的是,我仍然无法安装我的 brew 包,比如brew install octave。它说Error: You are using macOS 10.14. We do not provide support for this pre-release version. You may encounter build failures or other breakages. Please create pull-requests instead of filing issues.
        • 这个答案为我指明了正确的方向,但是,在手动安装了 Xcode Beta 2 和相关的命令行工具后,我将上面的代码块更新为 return false 而不是 return true(你已经已经安装了命令行工具,所以 brew 不应该)。然后我能够按预期安装自制软件,并且使用 brew 安装软件包也可以正常工作
        • 您可以通过安装 /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14 来避免修改脚本。包
        【解决方案7】:

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

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

        def should_install_command_line_tools?
          return **false**
        end
        

        【讨论】:

        • 您可以通过安装 /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14 在 /usr/include 中创建头文件。包
        • 是的,我们昨天也找到了相同的解决方案。谢谢@craig65535
        猜你喜欢
        • 1970-01-01
        • 2020-07-17
        • 1970-01-01
        • 1970-01-01
        • 2019-12-25
        • 2020-02-11
        • 2019-09-25
        • 2015-02-06
        • 1970-01-01
        相关资源
        最近更新 更多