MacOS – How to convert an .iso file to .dmg in terminal

dmgisomacos

I want to convert an .iso to .dmg, how can I do this from Terminal?

Best Answer

OS X has hdiutil, a command line tool for making, manipulating and using disk images with an option to convert between different types of images.1

To do this use the command with verb convert and option -format.

Option -o is used to specify the path and name of the output file.

There are several formats available from which I post two for .DMG and one for .ISO:

  UDRW - UDIF read/write image
  UDRO - UDIF read-only image
  UDTO - DVD/CD-R master for export

Use the first one for a read/write-able .DMG. The resulting command is:

hdiutil convert /path/file.iso -format UDRW -o /path/file.dmg

The backward conversion would be done by

hdiutil convert /path/file.dmg -format UDTO -o /path/file.iso