13

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?

Edric
  • 24,639
  • 13
  • 81
  • 91
lehadnk
  • 143
  • 1
  • 1
  • 6

4 Answers4

23

Go to /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg location and install package manually. And brew will start working.

manish poddar
  • 474
  • 3
  • 17
  • 4
    -bash: cd: /Library/Developer/CommandLineTools/Packages/: No such file or directory Just as I said earlier, there's no such directory on my system. – lehadnk Jul 11 '18 at 13:37
  • 1
    Did you find /Library/Developer/ ? If not then Select "Go to Folder" option in Finder menu option "GO". And type /Library/ . Here you should find. If you dont find here also, then install xcode command line tools once again. – manish poddar Jul 12 '18 at 05:49
  • 2
    in terminal, write without quotes: "open /Library/Developer/CommandLineTools/Packages/" – Ronen Jul 15 '18 at 11:48
  • For reference: If that directory/pkg doesn't exist for you, I had to update to the latest Beta for it to show up. – Andrew Li Jul 15 '18 at 22:05
  • 10
    This apparently is gone now in the most recent build and release of Xcode. – ylluminate Sep 20 '18 at 01:06
  • 10
    @ylluminate If you have an Apple developer account, this can be resolved by downloading `Command Line Tools (macOS 10.14) for Xcode 10` from [Apple's download page](https://developer.apple.com/download/more/) and then installing that package. Or you could just extract `macOS_SDK_headers_for_macOS_10.14.pkg` from the main package and install the SDK headers package without all the extra fluff. – GDP2 Sep 22 '18 at 04:51
11

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:

Broken command Line tools

Xcode Location on the Apple developers website:

Xcode Location on the Apple developers website

Location of command line tools:

Command Line Tools location

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

Do NOT install Xcode from app store because you need a different version!

Command line tools 10.14 update:

Command Line Tools 10.14 update

Edric
  • 24,639
  • 13
  • 81
  • 91
Dom Hallan
  • 1,057
  • 1
  • 8
  • 16
  • Command Line Tools beta3 didn't show up in the Software Update UI, so I updated it via command line: `softwareupdate --list` and `softwareupdate --install --all`. The error above goes away though `Error: You are using macOS 10.14.` is still showing up while trying to install sth. Any idea how to get that out of the way? – Fabian Jul 14 '18 at 11:06
  • I would think that is roughly the same problem as above. Consider going to https://developer.apple.com/download/more/ and downloading the command line tools. If you can't get it, leave a message and I will try and help you out. – Dom Hallan Jul 14 '18 at 14:17
  • 1
    @Dominique_Hallan: I just recognized that only the last 15 lines got posted, and the error was not in it and I did not see my mistake cause the `Error: you are using macOS 10.14.` was shown below the log lines. Thanks anyway. – Fabian Jul 14 '18 at 14:56
  • Awesome! @Purpose – Dom Hallan Jul 14 '18 at 15:03
7

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.

sorin
  • 161,544
  • 178
  • 535
  • 806
  • @pkamb It means you have to add this exports to you `.bash_profile` if you use Bash as a shell (I think if you would use zsh you know what is a profile). – Andrew Vyazovoy Apr 20 '19 at 21:58
-4

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.

file image

Community
  • 1
  • 1
留什么白
  • 57
  • 1
  • 6