I know that man -t ls | open -f -a /Applications/Preview.app produce a pdf of the man page of the ls command.

But the pdf produced is in US Letter size (21.59 cm x 27.94 cm).

The man page of man says that -t option use internally /usr/bin/groff -Tps -mandoc -c.

So, according the groff man, I tried this for obtaining A4 size (21 cm x 29.7 cm) in the pdf (A4 size is widely used in Europe):

man -t ls | /usr/bin/groff -Tps -mandoc -c -P-pa4 | open -f -a /Applications/Preview.app.

I obtain the A4 size as desired, but the formatting is ugly (no bold, italic, characters doubled, underscored)...

How to have the good formatting (as in the first command) AND the right size (as in the later command)?


Right now you are running groff twice, once as part of man -t, once on it‘s own on the PostScript file generated by man.


groff -Tps -mandoc -c -P-pa4 /usr/share/man/man1/ls.1 >out.ps
ps2pdf out.ps man-ls.pdf
open man-ls.pdf

or directly

groff -Tps -mandoc -c -P-pa4 /usr/share/man/man1/ls.1 | 
    open -f -a /Applications/Preview.app

To have it work for all man pages accessible to man, a little script will help.

page=$(man -W $1)
if [ -r "$page" ]; then
    groff -Tps -mandoc -c -P-pa4 "$page" | open -f -a Preview.app

Save it as manA4, run chmod +x manA4 once, and then use it as manA4 ls.

In case you are working with compressed man pages (which macOS does not use by default) you need to uncompress them on the fly.

page=$(man -W $1)
if [ -r "$page" ]; then
    if [[ "$page" =~ .*.gz$ ]]; then
        gzcat "$page" | groff -Tps -mandoc -c -P-pa4 | open -f -a Preview.app
        groff -Tps -mandoc -c -P-pa4 "$page" | open -f -a Preview.app
  • This solution does not work with compressed man pages. – fd0 Oct 30 '17 at 14:45
  • @fd0 I felt tempted to leave this as an exercise to the reader (especially because macOS doesn't work with compressed man pages by default) :-) – nohillside Oct 30 '17 at 15:26
  • True, but in man.conf, /usr/local/share/man is mapped which may have compressed man pages. – fd0 Oct 30 '17 at 15:45
  • Is ps2pdf a command? I do a man ps2pdf and also enter ps2pdf at a prompt and get error messages. – David Anderson Feb 13 '18 at 14:36
  • @DavidAnderson maybe I installed it through Homebrew or as part of TeX. But it‘s not required anyway, Preview can read and render Postscript files directly. – nohillside Feb 14 '18 at 7:41

Edit /private/etc/man.conf by commenting out the line

TROFF       /usr/bin/groff -Tps -mandoc -c

then add this line

TROFF       /usr/bin/groff -Tps -mandoc -c -P-pa4

Now man -t will write ps files in A4 paper size.

man -t ls | open .......
  • And don't forget to repeat this after every macOS upgrade... – nohillside Oct 29 '17 at 15:06

You must log in to answer this question.

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