Easily formatting printer options for PrinterGenerator

I’ve been using Nick McSpadden’s excellent PrinterGenerator script for about two years now. If you’re not familiar with the utility, it parses either command line options or a CSV file into munki pkginfo files that install the printer. The big deal (at least for me) is that the utility also creates a great install check script – this is way better than my old method of pushing a package, which doesn’t react at all if the user manages to remove the printer somehow.

We have some Ricoh machines that have a bunch of options as they’re full-featured production printers. I got sick and tired of editing these by hand, so I wrote a quick python script to parse the output of lpoptions and format it in a nice, easy to copy-paste way.


This should save you a few minutes. Set up the printer on your local machine to your liking and then run the script, passing the name of the printer queue to it (./printer-parser.py My_Printer). If you aren’t sure what the printer name is, do lpstat -p – it will show you all the printers you have added to your machine.