OS X: Create a Command to View UNIX “man” Pages as PDFs

A website tipped me off to a Terminal command that lets OS X users (the geekier ones) view UNIX “man” pages* as PDFs.

However, since the command is long, it would be hard to remember and difficult to type. I wanted to make an alias (a custom UNIX command) that would be shorter, but Bash (the default terminal in OS X) does not allow aliases to accept arguments (variables), which is critical to making this work.

I found a way to create a custom command that does this. Here are the steps:

  1. Edit your ~/.bash_profile with your favorite text editor
  2. Add this line:
    [cc]manpdf () { man -t $1 | open -f -a Preview.app ; }[/cc]
    (You could call it something other than “manpdf” if you want; you may also want to add a comment to remind yourself what it does.)
  3. Save it
  4. Try it: Open Terminal and type:
    [cc]manpdf ping[/cc]


*For newbies: The “man” command lists instructions — “manuals” — for various UNIX commands. For example, if you wanted to know how to use the “ping” command, you could open Terminal and type “man ping”.

Michael Prewitt

Michael Prewitt is a creative director who has worked with digital graphic design techniques since 1992. His core skills include highly refined aesthetic taste, exceptional creativity, and highly practical problem-solving ability; he also has complementary skills in related disciplines, including writing and editing, web developing, programming, photography, retouching, and illustration.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *