macOS 'wchar.h' File Not Found

First ensure that the latest XCode is installed. Next, we need to install/fix/update Command Line Tools. To do so, run

xcode-select --install

Previously, XCode expected it's active developer directory to be located at

/Applications/Xcode.app/Contents/Developer/

but the latest Command Line Tools is installed to

/Library/Developer/CommandLineTools/

so we need to switch where XCode is looking. To do so, run

sudo xcode-select --switch /Library/Developer/CommandLineTools/

And that should be it. These steps solved the issue for myself and two coworkers.


  • My error was similar to yours which said string.h not found, I solved it by running this command:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I think that the problem is that for macOS Mojave users, the headers are no longer installed under /usr/include by default.