Mounting OSX .DMG images from shell

This is an easy way to mount OS X installer packages (.dmg files) from the command line tool.

First of all, you must have your .DMG file, or you can download it still using the shell.

To download with command line use the curl command:

MacMini>curl http://web.address.pointing.to/the/file/to/download.dmg > myFile.dmg

Then to mount the image use the following command:

MacMini> hdid myFile.dmg

That’s all!