Hdiutil is a helpful command line utility which allows to manipulate disk images. With hdiutil you can attach, detach, verify, burn and perform other actions with disk images.
Below are several examples of using hdiutil.
To attach (mount) example.dmg disk image type:
hdiutil mount example.dmg
When you mount disk image it will appear under /Volumes folder. If you want to mount disk image under a different path your can either use -mountroot or -mountpath options like in example below:
hdiutil mount -mountpath /Volumes/folder example.dmg
Unmounting disk image is similarly done by the following command:
hdiutil unmount /Volumes/example
You can also burn an image on CD or DVD by running:
hdiutil burn example.dmg
To create a disk image with hdiutil you can use the following command:
hdiutil create -encryption -size 10m -volname encdata test.dmg -fs HFS+J
If you need to create a disk image from specific folder type:
hdiutil create -volname DiskImageName -srcfolder /path/to/the/folder -ov -format UDZO example.dmg
DMG Quick Info | |
---|---|
Apple Disk Image | |
MIME Type | |
application/x-apple-diskimage | |
Opens with | |
|
Open PDF File Translations: