Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm puzzled by how the path used for finding man pages is set. The "right thing" seems to happen magically. For example, if change my PATH from




the path searched for man pages (according to man --path) changes from




Somehow, the version of Git that I'm "overriding" the default Git with, is having it's documentation correctly found before any documentation for any built in Git. How is that happening?

share|improve this question
up vote 9 down vote accepted

The path for man is determined either by the env variable MANPATH or by constructing a MANPATH from PATH and /etc/manpath.config

The reason your local git man pages are being picked up first is because the MANPATH generated is in the same order present in PATH, so your /usr/local/git/bin at the beginning of PATH means that manpath will (if it can find it) place the matching man path at the beginning of MANPATH (in this case, /usr/local/git/share/man).

Paths that are earlier in your MANPATH are searched first and man(1) will display the first match.

For more information on this see manpath(1) and for the configuration file see manpath(5)

share|improve this answer
I have (on Darwin 12.2.0, OS X 10.8.2, bash 3.2.48(1)), /etc/manpaths, /etc/man.conf and several files in /etc/manpaths.d. How do those figure into the MANPATH building process? – raxacoricofallapatorius Feb 3 '13 at 23:15
@raxacoricofallapatorius those are platform specific so I am not sure, your question didn't specify platform. – cjh Feb 4 '13 at 1:00
That's a separate question then. – raxacoricofallapatorius Feb 4 '13 at 4:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.