Are man page sections 2 and 3 available in macOS Mojave?

Are the system calls (section 2) and library class (section 3) of the man pages available in macOS Mojave? I recently upgraded from an ancient MacBook Pro running OS X El Capitan and they aren't installed with Xcode, and I haven't found anything on how to get them installed.


Solution 1:

The manpages are installed with the command line tools. When I get a chance, I’ll edit the exact location to install from inside XCode. But, yes, there are manpages for sections 2 and 3, in Mojave.

Solution 2:

These should be installed with Xcode, yes.

To debug the paths that the man command is searching in, you can add the -d flag.

Towards the end of the output for running man -d malloc, I see the following:

adding /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/share/man to manpath
adding /Applications/Xcode.app/Contents/Developer/usr/share/man to manpath
adding /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man to manpath

Note: these will be different if you only have the commandline tools installed.

The xcrun system, which allows one to switch between Xcode versions, adds the correct paths to the manpath when you run man. Section 2 and 3 aren't found in the normal search locations /usr/share/man or /usr/local/share/man if that's where you have looked.

Bonus Note: If you set the MANPATH environment variable, the additional search paths are not added. Say you wanted homebrew man pages to be found before the base system pages, you might see this problem:

$ export MANPATH=/usr/local/share/man:/usr/share/man
$ man malloc
No manual entry for malloc