Mounting disk-images on macOS

You can mount iso and img files with hdiutil on macOS. I’ll write down both versions here.

:warning: Information

img-files are consideres as so called raw images while iso-files are plain ISO images. When I talk about img-files, I mainly talk about image files that I create with dd. Also note that I may use partitions as a word for slices here.

iso-files

The mounted image will be available in /Volumes.

$ hdiutil mount backupdisk.iso

img-files

raw images can be mounted with a more complex command. First we list the partitions available in that image container—we then mount only the needed partition.

$ hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount image.img
/dev/disk5            FDisk_partition_scheme
/dev/disk5s1          Windows_FAT_32
/dev/disk5s2          Linux
$ mount_msdos /dev/disk5s1 ~/test

We unmount that device when we finished our work with it.

$ hdiutil detach disk5
"disk5" unmounted.
"disk5" ejected.

Comments won't work at the moment

I'm sorry but the comments are offline. I'm not sure when I have fixed this issue, but I'll let you know when comments are back online.

Explore more:

macosterminal

↑ back to top