From the command line use the following syntax to mount the image:
hdiutil attach /path/to/diskimage.dmg
When the .dmg is mounted, a message will display something like this:
/dev/disk1 Apple_partition_scheme
/dev/disk1s1 Apple_partition_map
/dev/disk1s2 Apple_HFS /Volumes/Mounted Disk Image
Take note of the last entry with the name of the just mounted disk image, you will use the first part of this line to unmount the disk (/dev/disk1s2).
Unmounting a DMG from the Terminal
Recalling that the device name of the mounted image, use the following syntax to unmount the dmg:
hdiutil detach /dev/disk1s2
If you missed the device location earlier, you can retrieve information on all mounted drives and images by using:
hdiutil info
Locate the name of the mounted image and note the /dev/disk entry alongside of it.
