It's not entirely clear what you're trying to do here - since <errno.h>
is a standard library header, you will find it in: /usr/include/errno.h
... Edit - I can see your issue with Catalina now. See below:
At least on my (older) OSX box, this header isn't very informative - including <sys/errno.h>
in turn, which does at least provide the symbolic constants: EPERM, ENOENT, ...
(see: man intro
for an overview)
As <sys/errno.h>
itself includes further system headers, albeit headers that rarely concern user-space development, you can get an overview of how the compiler recursively finds these headers using the preprocessing stage:
clang -E /usr/include/errno.h
- this works for gcc
too.
For Catalina, the headers are now located under the SDK. I'm sure there are reasons for this - multiple SDKs (e.g., iphone development, etc), and some post-hoc rationale for security preventing the creation of a /usr/include
directory. In any case, for Catalina, you need the Xcode tool: xcrun
(see: man xcrun
) to find the SDK path to: .../usr/include
`xcrun --show-sdk-path`/usr/include
provides the path, so to view <errno.h>
:
less `xcrun --show-sdk-path`/usr/include/errno.h
and consequently, you can run the preprocessor with:
clang -E `xcrun --show-sdk-path`/usr/include/errno.h
This is cumbersome, and a lot of packages with their own build systems won't be aware of this requirement. So the useful option is to set a shell variable in your ~/.bashrc
- shell init files are a mess on OSX!
export CPATH=`xcrun --show-sdk-path`/usr/include/
Or whatever syntax your shell favours. I recommend the above, as 'sh'
(typically 'bash'
) is fundamental, and other shells inherit the variable. (Though since Catalina, you should probably be focusing on zsh
init files, since it's replacing bash
...)
$CPATH
will be honoured by both clang and gcc - I'm not sure it's technically a POSIX / BSD / ISO C standard (probably outside the scope of the latter); but is effectively ubiquitous across platforms.
So now you can just use: less $CPATH/errno.h
, or the preprocessor as:
clang -E $CPATH/errno.h