If you've bothered to check, by default the environment variable MANPATH
does not exist in current versions of Ubuntu. Try this:
echo $PATH
echo $MANPATH
This is due to man
's dependence on the command manpath
. Run it from the command line, and you'll find that its output is (effectively) MANPATH, yet we already know that no variable MANPATH is defined (by default):
manpath
/usr/local/man:/usr/local/share/man:/usr/share/man
The directories where manuals reside is contained in /etc/manpath.config
, and you can edit that file to add new folders. Try this; edit /etc/manpath.config
, and then see the result by running manpath
. If that's all you need (to add some folders containing manuals), this may be a good solution for you.
In my case, I needed to also set the order in which these manual folders were searched. I found no way to set order by editing /etc/manpath.config
(please correct me if I missed that). But of course you can do that when you edit your PATH env var, and you can do the same with MANPATH as it turns out. Here are some possibilities:
- To specify MANPATH independent of
manpath
:
export MANPATH="/first/path/tomanuals:/second/path/tomanuals:etc/etc/etc"
You may get a warning from your system to the following effect:
manpath: warning: $MANPATH set, ignoring /etc/manpath.config
Which is exactly what we wanted.
- To augment
manpath
such that the folder being added is searched first:
export MANPATH="/some/dir/with/manuals/man:$(manpath)"
Of course you can change the order around to suit your needs.
- Finally if you screw up, or just want to return control to
manpath
, do this:
unset MANPATH
echo $MANPATH
returns/usr/local/texlive/2012/texmf/doc/man
to me. When I add the paths to the configuration bash reports/usr/local/texlive/2012/texmf/doc/man:/usr/local/texlive/2012/texmf/doc/man
and zsh still report/usr/local/texlive/2012/texmf/doc/man
. For zsh I add the paths to/etc/zsh/zshrc
. I am not sure if this is correct. I also tried editing/etc/environment
, as suggested here, though without success. – JJD Aug 16 '12 at 23:18MANPATH=/usr/local/texlive/2010/texmf/doc/man:$MANPATH; export MANPATH
? I triedman tlmgr
and it says that it doesn't exist. – Feb 10 '15 at 21:29