MacOS – Regarding groff – where is the config file and will this work

command linehtmlmacosterminal

I've been reading Terminal Tips and Tricks For Mac OS X when I came across this.

bman () {
    gunzip < `man -w $@` | groff -Thtml -man | bcat
}

Apparently I should be able to view man pages with some HTML mark-up if I save this function somewhere.

The problem is that I don't know which config file it should go into. Are there any other things I should be aware of when using the code above?

Best Answer

For the first part of your question, "What file should the command go in?": put the command in ~/.bash_profile using your favorite editor. For example, you can do this using nano by opening Terminal and typing

nano .bash_profile

Type in the command and then press ctrl+X to exit. Say yes, you want to save the file.

For the second part, "Is there anything else I should know?": You are also going to need to install bcat, a program which allows you to send text to a browser via the command line. You can do this by running

sudo gem install bcat

in the terminal and entering your password.

Now you can view man pages in your browser by typing bman. For example:

bman ls