I installed the GNU core utilities via brew install coreutils. I also added PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH to the beginning of ~/.bash_profile (and it's auto-sourced in ~/.bashrc) as to enable accessing these utilities with their default names, ant not prepended with g.

I also want access to the man pages of these utilities, so I added MANPATH="/usr/local/opt/coreutils/libexec/gnuman:${MANPATH-/usr/share/man}" to ~/.bash_profile as the second line. Unfortunately, when I type man ls for example, I still get the BSD man page, instead of the Gnu one. How do I fix this?

  • .bash_profile should source .bashrc i.e. the opposite way to the way you have said gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html but that is probably not the issue – mmmmmm Aug 10 '16 at 9:47
  • what does echo $MANPATH show? – mmmmmm Aug 10 '16 at 9:48
  • @Mark /usr/local/opt/coreutils/libexec/gnuman:/usr/share/man – asafc Aug 10 '16 at 9:57
  • What happens if you- man gcat? – fd0 Aug 10 '16 at 10:14
  • The I get the man page for GNU cat. – asafc Aug 10 '16 at 10:32

OK, so after researching about $MANPATH with regards to Linux\UNIX, I came across the idea of adding export MANPATH right after defining it in ~/.bash_profile. This solves the problem as required, i.e. giving me access to man pages for coreutils, and only then to their BSD versions, if no GNU version exists.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .