9

Which .conf file do I need to edit in order to view man pages in a web browser? I'd like to use Google Chrome to do this.

Is this possible?

7

One way to do this is to put the following command in ~/.profile:

export PAGER="col -b  | open -a /Applications/Safari.app -f"

The PAGER environmental variable controls what program man uses to display man pages. the col command removes all of the backspace-formatting from the man page. The open command saves the output as a temporary text file and opens it with Safari.app.

Or you can edit the PAGER variable in /private/etc/man.conf. You could also probably edit the NROFF variable and eliminate the need to use col -b. See the man page for man.conf.

  • 1
    Thanks Nathan. That does the trick perfectly. I've just altered the line to read: export PAGER="col -b | open -a /Applications/Google\ Chrome.app -f" so it'll open in Chrome instead of Safari. – boehj May 21 '11 at 0:35
  • 2
    I'd been wanting to do this for myself anyway, and I'm glad I finally found time to look into it. I used TextWrangler with the command /usr/bin/edit --view-top --clean -t "Man page" – Nathan Grigg May 21 '11 at 1:13
6

http://www.bruji.com/bwana/ is exactly what you're looking for.

  • Cheers. That does look interesting, esp. "We just threw in some color, some bold headers and cleaned it up a bit, so they go easy on the eye." I wonder if I can get such functionality from further editing a .conf file? – boehj May 21 '11 at 2:12
4

You can add a function to your ~/.bash_profile:

function gman () {
     man "$1" | col -b > "/tmp/$1"
     open -a "/Applications/Google Chrome.app" "/tmp/$1"
}
  • This function wasn't working for me Graham. Not sure why. – boehj May 21 '11 at 0:39
  • Is Google Chrome in /Applications/ or somewhere else? – Graham May 21 '11 at 3:51
  • It's in /Applications/. – boehj May 21 '11 at 8:06
  • Just an additional step. After adding the function in profile folder. Make sure to source it or reopen terminal. link source ~/.profile – Bharath Kumar Nov 23 '15 at 10:39
  • In Safari I had to add an extension like /tmp/$1.txt. – 1.61803 Feb 2 '17 at 10:43

You must log in to answer this question.

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