"macOS_SDK_headers_for_macOS_10.14.pkg is incompatible with this version of macOS" while installing Haskell on OS X mojave

ZChen picture ZChen · Nov 17, 2019 · Viewed 7.1k times · Source

While running the following code block,

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

The installer warned

This package is incompatible with this version of macOS and may fail to install.

And when I choose 'Install Anyway', it fails.

How can I possibly get it work?

Some possibly relevant environmental versions:
OS: macOS 10.14.5
xcodebuild -version: Xcode 11.2.1
gcc --version: gcc (Homebrew GCC 9.2.0_1) 9.2.0

Bigger Context: I was setting up haskellstack, following instructions on https://docs.haskellstack.org/en/stable/install_and_upgrade/

while running $ stack setup I came accross

configure: error: in '~/.stack/programs/x86_64-osx/ghc-8.6.5.temp/ghc-8.6.5':
configure: error: C compiler cannot create executables
See 'config.log' for more details
Received ExitFailure 77 when running

and per the Notes section of the instructions, I ran

$ xcode-select --install

and it says

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

And then (following the same instructions) I ran

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

Answer

Octeny picture Octeny · Dec 2, 2019

My MacOS is 10.14.6

I found a solution in another website by MacrossEO, see https://donatstudios.com/MojaveMissingHeaderFiles

I had to removed the command line tools with 'sudo rm -rf /Library/Developer/CommandLineTools'

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg