How can I view man pages for apps installed via snaps?

I have a fresh installation of Ubuntu 16.04 LTS, and tried to install a few apps using the new snap packages. The installation of those packages goes easy, but when I try to do man <package> I cannot open the man page. For example:

$ man tmux  
No manual entry for tmux  
See 'man 7 undocumented' for help when manual pages are not available.

The whereis command gives me this output:

$ whereis tmux  
tmux: /snap/bin/tmux

But the truth is that the man page file exists:

$ ls -l $PWD/*  
-rw-r--r-- 1 root root 100394 Abr 20 06:46 /snap/tmux/current/share/man/man1/tmux.1

How can I get this to work? Is there any problem with the snap package management?


Solution 1:

A 'band-aid' solution is to run the following from the command line:

export MANPATH=":/snap/tmux/current/share/man"

and then the command man tmux will work as well as all of your pre-exisiting man pages. Bear in mind that Ubuntu does not normally use $MANPATH and the standard man pages PATH can be seen as follows:

andrew@athens:~$ man -w
/usr/local/man:/usr/local/share/man:/usr/share/man

After running the 'band-aid' solution suggested above you should see:

andrew@athens:~$ man -w
/usr/local/man:/usr/local/share/man:/usr/share/man:/snap/tmux/current/share/man

This setting can also be placed in ~/.bashrc for permanency, remembering that after placing it there either log out and then back in or simply run: source ~/.bashrc

Not very satisfactory I must say, especially if each package has a man page in a different location. Let us hope that as standards solidify this will be less of a problem...

References:

  • AskUbuntu: How to find out where $MANPATH is set? An excellent AskUbuntu question and answer that describes what the MANPATH is and how to manipulate it.
  • Snappy installed manpages aren't accessible through man Launchpad bug where the issue of viewing snap man pages is discussed.
  • Support for man pages Further discussion this time from the snapcraft forums.