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.
Run hdiutil attach followed by the image path; the volume appears in Finder under /Volumes.
01Command
Command
$ hdiutil attach ~/Downloads/AppInstaller.dmg02What 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
!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
- Create and work with disk images on MacEvidence: Apple documents double-clicking a disk image to mount it, which is what hdiutil does from the command line.
- hdiutil – Create and manipulate disk imagesEvidence: hdiutil attach mounts a disk image at /Volumes and prints the mount point; detach unmounts it.
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
Create an Encrypted Disk Image with hdiutil
Build an AES-256 encrypted .dmg vault from the Terminal — no Disk Utility clicking required.
Find files larger than 500 MB on Mac
List the biggest files in your home folder that are eating disk space.
Show file extensions for all files on Mac
Make Finder display .pdf, .docx, .png and every other extension at all times.