How to mount and unmount disk ISO and DMG images on macOS

Updated November 03, 2021 · Published May 04, 2014

You can use hdiutil to manually mount and unmount disk images, using the commands below. When mounting a file, make sure you replace filename with the correct file name. The same command works for both DMG and ISO files. When unmounting a disk image, be sure to replace disk1s1 with the correct volume identifier that will be shown to you after you mount the image.

Mount a DMG or ISO file

hdiutil attach filename.iso

Unmount the disk image

hdiutil detach /dev/disk1s1