1

I'm able to use man git when MANPATH is set to the following:

$ echo $MANPATH
/usr/local/opt/findutils/libexec/gnuman:/usr/local/opt/coreutils/libexec/gnuman:

However, when it doesn't include the trailing colon, man says it can't find the entry:

$ echo $MANPATH
/usr/local/opt/findutils/libexec/gnuman:/usr/local/opt/coreutils/libexec/gnuman

$ man git
No manual entry for git

The manpage is located at /Library/Developer/CommandLineTools/usr/share/man/man1/git.1, and I'm running the command from my home directory. I understand the trailing colon tells man to search the current directory as well as MANPATH, so why does it cause man to find the entry under /Library?

4
  • Outside and inside git, what happens if you type env | grep MANPATH. It's possible that your outside manpath isn't exported and so not really being used. The git.1 manpage is in /Library/Developer/CommandLineTools/usr/share/man/man1/git.1 on 10.11.5 which wouldn't be found with that MANPATH Commented Jun 28, 2016 at 0:30
  • 1
    @StephenHarris what do you mean inside git? Commented Jun 30, 2016 at 22:43
  • I meant "insude tmux" which is how the earlier version of your question read, and which you understood correctly in the previous incarnation. You appear to have totally rewritten the question and deleted your own comments... Commented Jun 30, 2016 at 23:03
  • @StephenHarris right, sorry I realized the problem has nothing to do with tmux. Commented Jun 30, 2016 at 23:09

1 Answer 1

1

You should not have to manually set MANPATH on a Mac.

Unlike most Unix-based systems, OS X automatically selects an appropriate search path for man pages based on the contents of PATH. The rules for this are described in the section "Search Path for Manual Pages" in manpath(1).

The configuration file for this has been in other locations in the past, but currently resides in /private/etc/man.conf. This file is read by manpath(1), which generates a suitable search path. However, this behavior is disabled if MANPATH is manually set in the shell.

Addressing the trailing :

Although I cannot find confirmation of this in the manpage, it appears that if MANPATH is set in the environment with a : at either end, the environment's MANPATH is added to the output of manpath.

Examples:

$ MANPATH='.:' manpath
/Users/me/.:/usr/share/man:/usr/local/share/man

$ MANPATH='':.' manpath
/usr/share/man:/usr/local/share/man:/Users/me/.
2
  • Unsetting MANPATH solved some problems, e.g. now I can use man git inside of tmux. However man ls displays the entry for BSD ls and not GNU ls which I installed through brew. I still don't understand the effect of the trailing :. Commented Jul 7, 2016 at 16:16
  • /usr/local/bin is before /bin in my PATH. I don't have /usr/local/man/man1 but I do have /usr/local/share/man/man1 and /usr/share/man/man1. It appears that brew puts mapages in the former but they are all prefixed with g. It also puts them in /usr/local/opt and advises you to add this to your MANPATH in your bashrc if you want e.g. man ls to work like you expect. Bleh. Commented Jul 8, 2016 at 15:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.