简体   繁体   中英

Brew install on Mojave

I did these steps:

  1. Updated to Mojave
  2. Installed Xcode 10 beta3
  3. Ran this command: sudo xcode-select -switch /Applications/Xcode-beta.app/

Now I'm trying to install 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. And brew will start working.

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. The process is the same minus that if you have Xcode 10, you don't need to install it again from my understanding.

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.

I posted a video here- https://youtu.be/GfnhSirTCGM that walks you thru part of my steps above. 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. Also grab the 10.14 command line tools as well. 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. I hope that I was helpful! The last thing is, INSTALL XCODE THEN COMMAND LINE TOOLS- IN THAT ORDER OR IT ERRORS OUT! 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. 14 July 2018

Broken command line tools:

损坏的命令行工具

Xcode Location on the Apple developers website:

Apple 开发者网站上的 Xcode 位置

Location of command line tools:

命令行工具位置

Do not install Xcode from the Mac App Store because a different version is required!

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

Command line tools 10.14 update:

命令行工具 10.14 更新

As of October 2018, the solution for making brew and brew install succeed is to:

  • install latest Xcode fom AppStore
  • run Xcode and install command line tools
  • 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.

The magic part is at the end, where xcrun obtains the correct location of the 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.

In my case MacOS 10.14.6 and xCode 11.1 with command line tools.

I had to install command line tools "MacOS 10.14 for xCode 10.3" on top of existing xCode 11 tools.

After that you will have "/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg" file, which you have to install.

Then install back proper command line tools for you xCode version to make sure xCode works as expected.

In terminal, you should first input the commands below

cd /Library/Developer/CommandLineTools/Packages

open .

you will open the directory on desktop, then double click the pkg file to install it.

文件图像

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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