How to mount dmg files on Linux

In Linux you can mount almost any formats! most people don’t know they can mount dmg files in Linux.

Dmg files are disk image format for Macintosh, file system type for dmg and cdr files in Mac is HFS+

in Linux you can mount it with this command:
# mount -o loop -t hfsplus image.dmg /path/to/directory/you/want
make sure the mount point (/path/to/directory/you/want) directory exists. you can mount it in /media/cdrom for instance if you didn’t insert any CD.

feel free to post your problems in comments

UPDATE: seems like hfsplus filesystem type is not working for everybody. there is another way of doing it. Basically DMG files are compressed IMG. So you need to decompress DMG to IMG file and then mount it. If you are using a debian-based distro, try apt-get install hfsplus first.

For that you need to download dmg2img from

tar -zxvf ./dmg2img.tar.gz
cd dmg2img
make all

If everything goes okay, then you can decompress your dmg file by executing the command,
./dmg2img -i /path/to/inputfile.dmg -o /path/to/outputfile.img
and remember, you must be inside the dmg2img directory at all times in order to run the command listed above. Also, the img file needs to be in the same location as the original dmg file. And preferably, the img file should have the same name as the dmg file.
After decompressing the dmg run

sudo modprobe hfsplus

then if hfsplus is installed (if not, run sudo apt-get install hfsplus ), run

sudo mount -t hfsplus -o loop /path/to/outputfile.img /mount/point

To create the mount point, run mkdir -p /mount/location

Note: hfsplus may not be installed by default. That might be why the first method is not working for some of you.

Leave your comment if works or not.