Mount .dmg images from command line

DMG images are the way that a lot of MacOSX binary packages are distributed. They are somehow like virtual hard disk images or .iso images that you can just mount with a simple double click if you have access to the gui.

But how do you do that from the command line?

quick answer:

hdiutil attach image.dmg

and the image should now be mounted somewhere in /Volumes

The hdiutil is a tool used to manipulate such disk images. It can do a lot more then just mount the images. It can even burn them to an optical media, convert them to an iso and some other formats , even compress them using gzip or bzip2 .