How to convert and burn a .dmg (Mac OS X) disk image on Linux

Today I wanted to burn a .dmg file, but I didn’t have an Apple computer available. So, running Linux I started to google for a solution, and found one.

You need the dmg2img tool, which can be downloaded from, if it’s not available as a pre-built package for your Linux distribution.

On Ubuntu you can easily install the dmg2img and hfsplus packages with sudo apt-get install dmg2img hfsplus.

Run the dmg2img tool to convert the .dmg file:

dmg2img -i file.dmg -o file.img

Next we want to mount the .img file (make sure you’ve got hfsplus tools installed) to a loopback device:

sudo mount -o loop file.img /mnt

The content of the image file is now available (within /mnt), so we can copy/use the files or burn an ISO image.
To create an ISO image type:

cd /mnt && genisofs -o $HOME/file.iso .

Update 2014-04-24

Install dependencies on Ubuntu/Debian with:

sudo apt-get install build-essential zlib1g-dev libbz2-dev libssl-dev hfsplus

And compile: