Easy preview of groff output on Mac OS X

On your UNIX based X terminal, you probably use xditview to preview the output of groff.

On Mac OS X you can install XQuartz as your X11 server and still use the same workflow. However you can also use the Preview.app that comes installed with Mac OS X, feed it the PostScript output and have Preview automatically convert PostScript to PDF on-the-fly and preview it. This way you don’t have to launch X11 and at least for me using Preview made the whole workflow more pleasant.


pic /usr/share/doc/groff/1.19.2/pic.ms | groff -ms | open -n -f -a Preview

You can adapt the command line to your own needs. The only important part comes after the last pipe: open -n -f -a Preview, which simply tells OS X to open the application Preview (-a Preview) as a new application (-n) and feed it the data from stdin (-f).
In case you have like me a more complex workflow, you may want to use some elaborated Makefile to further ease and speed up your edit-preview cycles invoking make directly from e.g. vi.