There's a previous question Can't compile C program on a Mac after upgrade to Mojave, and the answers to that have covered most of the variations on what goes wrong.
Now — as of Monday 2019-10-07 — you can upgrade to macOS Catalina 10.15. Once again, during the upgrade, the /usr/include
directory has been blown away by the update, even though XCode 11.0 was installed before upgrading (from Mojave 10.14.6) to Catalina. Consequently, compilers built to expect that there is a /usr/include
directory do not work any longer.
The main recommended step for the Mojave issues — using the command:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
does not work out of the gate because the directory /Library/Developer/CommandLineTools/Packages/
does not exist (so there's not yet a .pkg
file to open).
Is there a good (official) way to create and populate the directory /usr/include
?
C code can be written in any platform like Mac, Windows, etc. C compilers compile C code and create an executable according to the platform. The executable created for one platform can only be executed on that platform.
If Apple follows the same "unofficial" plan that they have been following, Catalina support will end sometime after WWDC 2022.
However, no operating system is without issues, and Catalina is no exception. While typical installation and performance problems shouldn't come as a surprise, macOS 10.15. 7 still has some quirks that may need addressing.
Before you proceed, make sure to install xcode command line tools.
xcode-select --install
Actually, you can do it! Actually all the C headers are found here in this folder:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/
We just need to create symlink for all the headers file into this folder:
/usr/local/include/
It worked for me! the following command line will take care of all the problems:
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/
You will get some warning. Some of the headers already exists, like this:
ln: /usr/local/include//tcl.h: File exists ln: /usr/local/include//tclDecls.h: File exists ln: /usr/local/include//tclPlatDecls.h: File exists ln: /usr/local/include//tclTomMath.h: File exists ln: /usr/local/include//tclTomMathDecls.h: File exists ln: /usr/local/include//tk.h: File exists ln: /usr/local/include//tkDecls.h: File exists ln: /usr/local/include//tkPlatDecls.h: File exists
totally ok to ignore. that's all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With