Bits, bytes and beauty

Sunday, November 11, 2007

Leopard shell annoyances

After having been bitten by the erroneous LANG=UTF-8 environment variable that Terminal added (you can disable it in the prefs under Advanced), I decided to figure out why man port would claim there is no man page for port.

The problem turns out to be not any misconfiguration of /etc/man.conf, that file is fine as it is. The real problem is the MANPATH environment variable that's shown up out of nowhere. Or rather, it's set by /usr/libexec/path_helper from the shell startup files. The goal of path_helper is to make it easy to add entries to everyone's PATH, in particular entries for X11. But path_helper doesn't seem to know that also setting MANPATH is a) unnecessary with a modern man program and b) detrimental, because setting MANPATH disables the automatic matching of man directories with bin directories in your PATH.

I fixed it by unsetting MANPATH in my shell startup file.

3 comments:

Anonymous said...

Thanks for that tidbit. I'm so used to manually setting $MANPATH, I didn't realize that modern systems had grown to accommodate it by riffing off your $PATH.

Pete said...

I don't know if they're riffing off PATH, but certainly there is also this stuff:

% ls -al /etc/man*
-rw-r--r-- 1 root wheel 4589 Sep 23 2007 /etc/man.conf
-rw-r--r-- 1 root wheel 36 Apr 23 10:39 /etc/manpaths

/etc/manpaths.d:
total 8
drwxr-xr-x 3 root wheel 102 Dec 5 2007 .
drwxr-xr-x 95 root wheel 3230 Aug 7 11:08 ..
-rw-r--r-- 1 root wheel 13 Dec 5 2007 X11

Anonymous said...

path_helper reads the contents of /etc/manpaths.d and adds the paths to $MANPATH_MAP. Not sure what reads /etc/manpaths, but they also end up in $MANPATH_MAP.