Blog > Viewing man pages in Preview

 Viewing man pages in Preview


Today I found this tip on that describes how to see man pages as pdf files. I loved the idea (it's great for searching), but not the implementation (the script creates the pdf files in /tmp, so they're deleted at each restart, and if you call it several times for the same man page, it recreates the same pdf file over and over again).

So I wrote my own version that stores the pdf files in a predefined folder and creates them only once (that is if a pdf file already exists it will just open it).


set pdfManFolder = <myFolderPath>

if !( `filetest -e $pdfManFolder/$1.pdf` ) then
  echo Creating $1.pdf
  man -t $1 > /tmp/$
  pstopdf /tmp/$ -o $pdfManFolder/$1.pdf

open $pdfManFolder/$1.pdf

 Previous Comments

There are no comments yet. Be the first to post one!

Please Log in if you wish to comment.