MacOS – man -k and apropos cannot find pages in section 3 in Catalina

catalinacommand linemacosmanterminal

For example, run apropos printf:

Printf(3o)               - Formatted output functions
Stdlib.Printf(3o)        - no description
gprintf(1), printf(1)    - format and print data
format(ntcl)             - Format a string in the style of sprintf
fwkpfv(1)                - FireWire kprintf viewer
printf(1)                - formatted output
xprintf(5)               - extensible printf

printf(3) is not listed, but man 3 printf can find that man page.

Meanwhile, stderr prints many errors like this one:

makewhatis: /usr/lib/libgcc_s.1.dylib: Not a directory

What should I do to make apropos and man -k work properly?

Best Answer

Saw a handy shell trick posted in Apple Discussions to get rid of the hundreds of error messages whenever doing a man -k or apropos type inquiry:

apo() { apropos "$@" 2> /dev/null; }

myman() { man "$@" 2> /dev/null; }

See https://discussions.apple.com/thread/250812698 for the discussion.