I love using the Terminal's man page viewer. You can right click on anything and open its corresponding man page. Or just run open x-man-page://1/<man page>
However, I'm having trouble getting Terminal to prioritize the right man page over a pre-installed one. Specifically it's the man page for the newer version of rsync
installed by homebrew. Running man rsync
in a shell shows the correct rsync manpage, from /usr/local/share/man/man1/rsync.1
, but using Terminal's manpage viewer shows the man page for the old version of rsync from /usr/share/man/man1/rsync.1.gz
.
A very temporary solution is to run Terminal like this:
$ MANPATH=/usr/local/share/man /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
That starts Terminal with MANPATH
set and it then looks in the right spot to find the new rsync man page. But setting MANPATH overrides all the other smart ways of finding man paths.
Note that the issue only shows up when there's multiple man pages for the same command. Somehow man rsync
knows to prioritize the man page installed by Homebrew in /usr/local/share/man
but Terminal prioritizes /usr/share/man/
I tried editing /private/etc/man.conf
and to /usr/local/share/man
first, but it had no effect. Even commenting out all the /usr/share/man
references had no effect.
Any ideas how to get Terminal's x-man-page://
to prioritize the right man page like just running man
does? Cheers!
export MANPATH=/usr/local/share/man:$MANPATH
in your .profile or .bashrc or whatever your shell needs.MANPATH
is already undefined and this defines it. Defining anyMANPATH
disables the "smart" man path finding thatman
already does. With myMANPATH
empty it finds manpages is a variety of locations. Runningman -w -a "*"
will list every man page and doingman -w -a "*" | sed -E "s/\/[^\/]*$/\//g" | sort | uniq
reveals that there's 57 uniq man page directories on my system. I want to keep using the "smart" man path finding and not have to enumerate every one (since they often change)