Mounting a Disk Image File (DMG) from the Terminal:
(this works the same for ISO and IMG files as well)
hdiutil attach /path/to/your/diskimage.dmg
When the .dmg is mounted, a message will display something like this (not that hditul will try to use the dmg filename as the directory name it creates in /Volumes):
$ hdiutil attach diskimage.dmg 9:49
Checksumming Gesamte Disk (Apple_HFS : 0)…
...........................................................................................................................................
Gesamte Disk (Apple_HFS : 0): verified CRC32 $75753E80
verified CRC32 $83E2BD54
/dev/disk2 /Volumes/diskimage
Unmounting a DMG from the Terminal is just as easy:
hditul detach /Volumes/diskimage
or (CAUTION: where /dev/disk2 is the one hdiutil created this during mounting the DMG file)
If you are not sure anymore what was mounted where, then try using this to see a list:
hdiutil info
This will output something like this (depending on your situation of course):
framework : 623.100.1
driver : 623.100.1
================================================
image-path : /Users/hans/Downloads/diskimage.dmg
image-alias : /Users/hans/Downloads/diskimage.dmg
shadow-path : <none>
icon-path : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type : UDIF read-only compressed (zlib)
system-image : false
blockcount : 32768
blocksize : 512
writeable : false
autodiskmount : TRUE
removable : TRUE
image-encrypted : false
mounting user : hans
mounting mode : <unknown>
process ID : 52538
framework name : DiskImages
/dev/disk2 /Volumes/diskimage