Fix missing man pages for self-installed utilities

Mar 06, '06 05:36:00AM

Contributed by: jonbauman

The rule is to install any custom UNIX utilities in /usr/local, but unfortunately due to the way man is set up, the man pages for things installed in /usr/local may not be found.

The problem is that the man configuration file (/usr/share/misc/man.conf) defines a number of MANPATH_MAP directives. Here are some of them:

MANPATH_MAP    /usr/bin                /usr/share/man
MANPATH_MAP    /usr/sbin               /usr/share/man
MANPATH_MAP    /usr/local/bin          /usr/local/share/man
This means, for instance, that if you type man grep, man examines your PATH variable and finds that the grep executable is in /usr/bin. The MANPATH_MAP directive instructs it to look in the /usr/share/man directory to find the man page for grep. This overrides man's default behavior, which would be to look in the "nearby" directory /usr/man, which does not exist.

However, in the case of software installed in /usr/local, the man pages are more commonly (at least in my experience) installed in /usr/local/man, not /usr/local/share/man, so that MANPATH_MAP directive does the opposite of what we want.

If you keep all your /usr/local man pages in /usr/local/man rather than /usr/local/share/man, the simple solution is just to comment out that one MANPATH_MAP directory. You'll need to use sudo, since the /usr/share/misc/man.conf file is owned by root.

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060228203534793