The command man bash produces a lot of output. What I desire would be to either search the results or print the results to paper. So, is there a way to convert a man page to a html and/or pdf document.

I would prefer the answer work for not only man bash, but rather for any man page.

I know the output from man bash has been posted on the internet, but usually these posts are not current.

  • 1
    A Mac specific solution for PDF is discussed in apple.stackexchange.com/questions/303737/… Commented Feb 13, 2018 at 14:16
  • @Ture: How do enter the ps2pdf command? Is the command hiding somewhere? Commented Feb 13, 2018 at 14:32
  • 1
    If you're happy with US letter format and an interactive workflow, you don't need ps2pdf; just run man -t ls | open -f -a Preview and then save as PDF from Preview. Otherwise, ps2pdf comes as part of the Ghostscript package which, I believe, is most easily installed via Homebrew. Commented Feb 13, 2018 at 14:51
  • For a convenient way to browse PDFs of man pages in your browser, you can use Bwana. Commented Feb 13, 2018 at 21:37
  • Since you mention HTML. It's not an answer for your question, but maybe a practical alternative: Virtually all man pages are on the internet. Hence, a search for i.e. man bash or macos man grep will bring up a web page, which, by its nature, is HTML. The main disadvantage of this approach is that you don't necessarily find the man page corresponding to the exact program version you are running, but if you can live with this restriction, let Google be your friend. Commented May 27 at 10:05

4 Answers 4


Yes, there are numerous tools to convert manual pages to HTML and PDF.

UNIX Approach

Converting a man page to HTML, PDF, and text provides detailed instructions for macOS:

cat /usr/share/man/man1/osascript.1 | groff -mandoc -Thtml >man_osascript.html

If the file ends in .gz, then substitute the following.

gunzip --to-stdout /usr/share/man/man8/cupsfilter.8.gz | groff -mandoc -Thtml >man_cupsfilter.html

For converting from HTML to PDF:

cupsfilter man_osascript.html > man_osascript.pdf

For other tool chains, see these related questions:


Another approach is to use the popular pandoc tool. This tool can convert manual pages to a wide range of formats.

Link x-man-page

macOS's Terminal.app offers a x-man-page URL scheme for pretty printing manual pages. Try opening the link below to see the ls man page:

  • 1
    Just to verify: On MacOS, man doesn't support the -T option directly? Commented Feb 13, 2018 at 16:56
  • If you use modern Debian/Ubuntu and install package groff you can just do man -Tpdf osascript > osascript.pdf. Commented Jan 16, 2019 at 16:06
  • Good contribution. But does the error only come to me? cupsfilter: No filter to convert from text/html to application/pdf.
    – BabyBoy
    Commented Apr 6, 2022 at 4:57
  • @Lano I suspect the error you are seeing is related to the version of macOS you have. Please can you ask this as a new question so others can better help you. Commented Apr 6, 2022 at 9:07
man -t yourcommand | open -fa "Preview"

where yourcommand is the one you want the man page of.

$ man -t tmutil | open -fa "Preview"


Here is a function I added to my .bash_profile file to create a PDF of each BSD command I'd check the manual page for:

manp () 
    docDir="$HOME/Documents/BSD Commands"
    [[ ! -d $docDir ]] && mkdir -p "$docDir"
    if [[ ! -f $docDir/$1.pdf ]]; then
        man -t "$1" | pstopdf -i -o "$docDir/$1.pdf"
        open "$docDir/$1.pdf"
        open "$docDir/$1.pdf"

So, in Terminal, typing e.g. manp bash instead of man bash a PDF gets created, if it hasn't already been, and then opened by the app registered to handle PDF documents. The default is Preview, however on my system it's set to use Skim, as its search functionality is better then Preview and as a matter of fact will find the search string when Preview just will not.

Note that the first time the function is used it will enumerate some fonts in the output in Terminal, however this is a one time enumeration of the fonts.

As a side note, typing just the command name in Terminal and then right-click on it and select Open man Page, displays it in a fully scrollable and searchable Terminal window, which is much better then typing e.g. man bash.


As suggested here, the *roff runoff processors are no longer included with MacOS 10.13 (Ventura). As a result man -t … fails to format the requested page.

Among other formats, mandoc can produce either PDF or HTML:

mandoc -T pdf $(man -w zsh) | open -fa Preview 
mandoc -T html $(man -w zsh) > zsh.html

Note the use of man -w to obtain the location of the manual page for mandoc to process.

You must log in to answer this question.

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