Add Mac OS X support, fix problems I encountered while debugging

I left these as separate commits in case you want some but not all of it -- the first two are DRY as we're building up the filenames to download and fixups for error checking; the third is a hokey-yet-functional installation for Mac OS X dmg from http://downloads.puppetlabs.com/mac/