Install C standard library man pages on macOS

150 Views Asked by At

I recently updated the 2020 M1 Macbook pro I use for school to macOS Ventura, 13.4.1. Since then, I haven't been able to access C standard library man pages from the terminal. Any idea how I can regain access to the man pages?

For example, typing 'man 2 exit' just returns 'no manual entry for exit'. I have downloaded homebrew and xcode, but just downloading these resources hasn't fixed the problem.

Edit: I meant 'man 3 exit'.

2

There are 2 best solutions below

0
Rob Napier On BEST ANSWER

The pages you're looking for are distributed with Xcode. man finds them using xcode-select --show-manpaths, so try running that to see if everything is installed correctly. On my machine, the exit(3) page is in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man/man3/exit.3.

How do I know that? Well, man is open source. You can go look at how it works. (And it's just a shell script.)

Also useful, you can pass -d (or -dd) to get information about where man is looking for things and where it find them.

My guess is that xcode-select isn't set up properly. It might point to some uninstalled version. In that case use xcode-select -s to set the correct version as default. If you use multiple versions of Xcode, I highly recommend Xcodes.app, which does a great job of maintaining that correctly.

1
Caleb On

For example, typing 'man 2 exit' just returns 'no manual entry for exit'.

The exit function (and the rest of the standard library) are in section 3, not 2. Typing

man 3 exit

will get you the documentation for the standard library's exit function.

Section 2 documents system calls. Try man man to get a list of the standard man page sections.