UPDATE – So a friend just turned me on to the fact that you can actually talk to a drive via a raw path in OSX. Using a device name like /dev/rdisk2 bypasses any extra buffer cache in between you and the raw disk. So in the example below, the entire operation would move much faster by using /dev/rdisk2 instead of just /dev/disk2. Thanks to Jared for notifying me of this and superuser.com for explaining!

Its literally the same as on linux, except for you need to properly unmount making the entire process look something like this:

diskutil list diskutil unmountDisk /dev/disk2 dd if=inputfile.img of=/dev/disk2

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.