Mounting and unmounting a disk image (dmg) in OS X

A file with the extension .dmg uses a proprietary disk image format commonly found on Mac OS X (well, usually: you can use any extension anywhere, obviously) .

The command used for manipulating disk images is hdiutil

$ hdiutil attach nmap-5.00.dmg 
esperado   CRC32 $C955C266
/dev/disk2              Apple_partition_scheme         
/dev/disk2s1            Apple_partition_map            
/dev/disk2s2            Apple_HFS                       /Volumes/nmap-5.00

This command will attach a disk image to the system as a device. attach will return information about an already-attached image if it had already attached it. mount is a synonym for attach.

$ hdiutil detach /Volumes/nmap-5.00/
"disk2" unmounted.
"disk2" ejected.

The above command will detach a disk image and terminate any associated hdid process. eject is a synonym for detach.

There are useful encryption options which we shall speak of in a forthcoming post.

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*Required Fields