1

I have both gnu utilities (via brew) as well as mac default command line tools installed on my Mac.

How do I specify to man utility that I want to invoke

  • gnu specific tar
  • bsd tar

There are my tar locations.

$ which -a tar
tar is /usr/local/bin/tar
tar is /usr/bin/tar
  • If it were me doing it, I would install GNU tar (and its manpage) as gtar. No idea if brew does this or can be made to do it. – Random832 Jul 15 '16 at 02:13

2 Answers2

4

More likely than not, they're in the same section of the manpages, e.g., 1. But you can get all of the manpages for a given name using the -a option, and pick through the result:

man -a tar

More complicated, you can tell man which directories to search using the -M option, e.g.,

man -M /usr/local/man tar

for brew, and

man -M /usr/man tar

for OSX.

Further reading:

Thomas Dickey
  • 76,765
1

With man, you can always give an absolute path to a manual page. For the built-in BSD utilities, this will be something like:

man /usr/local/share/man/man1/tar.1

Now, this isn't particularly convenient, since you have to know the exact path to the page. For GNU utilities with the same name as built-in BSD utilities, you can note that brew installs manual pages in /usr/local/share/man with prefixes:

# For brew's GNU tar:
man gtar

# For the built-in BSD tar:
MANPATH= man tar

The MANPATH= part is to reset any changes that may have been made per suggestions by brew to ensure that its pages are seen first.

Fox
  • 8,193