N Kaushik

How to fix _stdio.h No such file or directory in MacOS

February 14, 2021

How to fix _stdio.h: No such file or directory

This error occurs while compiling a c file using gcc in MacOS.

/usr/local/Cellar/gcc/10.2.0_3/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0/include-fixed/stdio.h:78:10: fatal error: _stdio.h: No such file or directory
   78 | #include <_stdio.h>
      |          ^~~~~~~~~~
compilation terminated.

fatal error: _stdio.h: No such file or directory

Normally I face this issue after mac os update or XCode update.

Solution:

The easiest way to fix this is by installing the command line tools. Open one terminal window and run the below command:

xcode-select --install

It will show a popup asking you to install: xcode select install

Click on the install button and install it. Start a new terminal and it will work.


Subscribe to my Newsletter

© 2021, nkaushik