The Old Method

I used to create ISO files on Mac OS X using Disk Utility, but I really wanted a command-line way of doing it, also because the default output file format when you use Disk Utility to do this is Mac-specific (it created .dmg files). The resulting file would need to be converted before you can open it in Windows. The command I used to use was this:

hdiutil convert Desktop/image.dmg -format UDTO -o Desktop/new_image.iso

The New Method

I have been using this new method for a while and it seems to be working fine so far: the resulting iso files can be read both on Mac and on Windows and it only takes two commands in Terminal.

First of all, list all your mounted devices:

diskutil list

One of the items, supposing your CD/DVD is inserted and mounted, will be the disc that is inserted in your drive. The device itself will be something like /dev/disk2, and the actual partition inside it containing the files will be /dev/disk2s0.

Note: if you use the physical device instead of the partition inside it, the iso file will be created but you won’t be able to mount it.

Now that you know your device identifier, you can start the cloning process with dd:

sudo dd if=/dev/disk2s0 of=/Desktop/your_file.iso

There you go, nothing else to be done and no conversion necessary ;)