简体   繁体   English

在 Mojave 上安装 Brew

[英]Brew install on Mojave

I did these steps:我做了这些步骤:

  1. Updated to Mojave更新到莫哈韦沙漠
  2. Installed Xcode 10 beta3已安装 Xcode 10 beta3
  3. Ran this command: sudo xcode-select -switch /Applications/Xcode-beta.app/运行此命令: sudo xcode-select -switch /Applications/Xcode-beta.app/

Now I'm trying to install node8:现在我正在尝试安装 node8:

brew install node@8

And it gives me this error:它给了我这个错误:

Error: The Command Line Tools header package must be installed on Mojave.
The installer is located at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

Still, doing仍然,做

install -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

does nothing, since there's no such file in my system.什么都不做,因为我的系统中没有这样的文件。 Where could I get it?我在哪里可以得到它?

Go to /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg location and install package manually.转到 /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg 位置并手动安装包。 And brew will start working. brew 将开始工作。

I want to try and answer this question and also for those that come later that installed Mojave and had an older Xcode version installed.我想尝试回答这个问题,也想回答那些后来安装 Mojave 并安装了旧 Xcode 版本的问题。 The process is the same minus that if you have Xcode 10, you don't need to install it again from my understanding.这个过程是相同的,如果你有 Xcode 10,根据我的理解,你不需要再次安装它。

The folder is hidden and was not accessible even with a sudo find command, however, I figured out that copying the absolute path and then pasting it in your browser address bar will give you the download and access to the folder that you need to fix brew install.该文件夹是隐藏的,即使使用sudo find命令也无法访问,但是,我发现复制绝对路径然后将其粘贴到浏览器地址栏中将为您提供下载和访问您需要修复 brew 的文件夹的权限安装。

I posted a video here- https://youtu.be/GfnhSirTCGM that walks you thru part of my steps above.我在这里发布了一个视频 - https://youtu.be/GfnhSirTCGM ,它会引导您完成我上面的部分步骤。 After you do the SDK headers download, its likely that unless you already are running Xcode 9.4, you will need to visit, https://developer.apple.com/download/more/ and look for Xcode 9.4 to install.下载 SDK 头文件后,除非您已经在运行 Xcode 9.4,否则您可能需要访问https://developer.apple.com/download/more/并查找要安装的 Xcode 9.4。 Also grab the 10.14 command line tools as well.还可以使用 10.14 命令行工具。 The lesson that should be learned here is that Apple calls it "Beta" for a reason and if you are a developer that knows the pains of setup, it is a bad idea.在这里应该吸取的教训是,Apple 将其称为“Beta”是有原因的,如果您是一名了解设置过程的开发人员,那么这是一个坏主意。 I hope that I was helpful!我希望我有帮助! The last thing is, INSTALL XCODE THEN COMMAND LINE TOOLS- IN THAT ORDER OR IT ERRORS OUT!最后一件事是,先安装 XCODE,然后再安装命令行工具——否则会出错 and then we do this all over again.然后我们再做一遍。 Cheers!干杯!

It appears as though Apple has released a patch for the bug and it is available through the system preferences.似乎 Apple 已经发布了该错误的补丁,并且可以通过系统首选项获得。 14 July 2018 2018 年 7 月 14 日

Broken command line tools:损坏的命令行工具:

损坏的命令行工具

Xcode Location on the Apple developers website: Apple 开发者网站上的 Xcode 位置:

Apple 开发者网站上的 Xcode 位置

Location of command line tools:命令行工具的位置:

命令行工具位置

Do not install Xcode from the Mac App Store because a different version is required!不要从 Mac App Store 安装 Xcode,因为需要不同的版本!

不要从应用商店安装 Xcode,因为您需要不同的版本!

Command line tools 10.14 update:命令行工具 10.14 更新:

命令行工具 10.14 更新

As of October 2018, the solution for making brew and brew install succeed is to:截至 2018 年 10 月,使 brew 和 brew install 成功的解决方案是:

  • install latest Xcode fom AppStore从 AppStore 安装最新的 Xcode
  • run Xcode and install command line tools运行 Xcode 并安装命令行工具
  • add the line before to your profile or somethign similar将之前的行添加到您的个人资料或类似内容中

export CFLAGS="-I/usr/local/include -L/usr/local/lib -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include"

No need to download Xcode manually, but you may want to remove the beta version if you installed it.无需手动下载 Xcode,但如果您安装了它,您可能需要删除测试版。

The magic part is at the end, where xcrun obtains the correct location of the SDK.神奇的部分在最后,xcrun 获取 SDK 的正确位置。

For those of you who couldn't find "macOS_SDK_headers_for_macOS_10.14.pkg" file, this is most likely because you have installed xCode 11, which doesn't have it. 对于那些找不到“ macOS_SDK_headers_for_macOS_10.14.pkg”文件的人,这很可能是因为您已经安装了xCode 11而没有安装。

In my case MacOS 10.14.6 and xCode 11.1 with command line tools. 在我的情况下,MacOS 10.14.6和xCode 11.1带有命令行工具。

I had to install command line tools "MacOS 10.14 for xCode 10.3" on top of existing xCode 11 tools. 我必须在现有xCode 11工具之上安装命令行工具“ MacOS 10.14 for xCode 10.3”。

After that you will have "/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg" file, which you have to install. 之后,您将具有必须安装的“ /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg”文件。

Then install back proper command line tools for you xCode version to make sure xCode works as expected. 然后为您的xCode版本安装适当的命令行工具,以确保xCode可以正常工作。

In terminal, you should first input the commands below在终端中,您应该首先输入以下命令

cd /Library/Developer/CommandLineTools/Packages cd /Library/Developer/CommandLineTools/Packages

open .打开 。

you will open the directory on desktop, then double click the pkg file to install it.您将在桌面上打开该目录,然后双击 pkg 文件进行安装。

文件图像

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

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