Many of my c-lang-related things didn't work after I upgraded my mac to Mojave. For example, my CLion IDE could not find headers anymore. Some libraries couldn't be installed because of missing headers. In previous updates, these problems usually could be solved easily by install command line tools.

However, it seemed like command line tools were not sufficient to solve it. I googled it around the internet. I finally found the trick hidden by Apple. It was not straight forward at all.

To solve this, the very first step is still to install command line tools.

xcode-select --install

The next step is important. Open your terminal, and change the directory to /Library/Developer/CommandLineTools/Packages/ and open the headers installer.

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

Follow the installer's instruction. It will install all the headers for you.