Creating, mounting, and dismounting disk images from the command line
Recently I was writing a shell script in which I needed to create a disk image, mount it, write to it, and dismount it. The command in OS X that manages disk images at the command line is hdiutil, and the man page is rather long.