Mount a DMG or ISO Disk Image with hdiutil attach

Attach disk images from the command line and get the mount point printed in the Terminal.

macOSFileshdiutildisk-imageLow risk
Run hdiutil attach followed by the image path; the volume appears in Finder under /Volumes.

01Command

Command
$ hdiutil attach ~/Downloads/AppInstaller.dmg

02What it does

The last line of output tells you exactly where the image mounted, which is handy inside scripts — capture it with hdiutil attach image.dmg | tail -1 | cut -f3. Use -nobrowse to keep the volume from popping up in Finder. hdiutil detach with that mount point unmounts it cleanly, equivalent to dragging the volume to the Trash.

03Risk

RiskLow risk
!Warning: If the image contains an installer app, copying it to /Applications before ejecting is what actually installs it.

04Undo

Undo
$ hdiutil detach "/Volumes/AppInstaller"

05Sources

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions