Skip to content

Instantly share code, notes, and snippets.

@rjhornsby
Last active February 27, 2021 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjhornsby/15af2ea8f794be6a8f6ec2403b2f0eea to your computer and use it in GitHub Desktop.
Save rjhornsby/15af2ea8f794be6a8f6ec2403b2f0eea to your computer and use it in GitHub Desktop.
Mount ISO in MacOS

Credit: https://unix.stackexchange.com/questions/298685/can-a-mac-mount-a-debian-install-cd

This is one of those "I have to do this occasionally and can never remember how" things - mounting an ISO in macOS, especially Linux ISOs.

macOS has a few things that are stupid. Trying to mount a .iso file directly using normal means ends in failure:

hdiutil: mount failed - no mountable file systems

It's completely doable, unlike other image formats (.img, .dmg, etc), just takes a bit more effort.

load the ISO9660 (cd-rom/iso format) extension

macOS 11+ (Big Sur)

sudo kmutil load -p /System/Library/Extensions/cd9660.kext

macOS 10.x

sudo kextload /System/Library/Extensions/cd9660.kext

Haven't take the dive into Big Sur yet, but loading the kext happens automagically in macOS 10.x.

Attach and mount the ISO

hdiutil attach -nomount </path/to/your/iso_file>

Take note of the device name - ie /dev/disk7

mkdir -p /tmp/iso_mnt
mount -t cd9660 <device_name> /tmp/iso_mnt

Unmount and detach the ISO

Make sure anything using the ISO contents is closed, and that you're not cd'd into the directory in your terminal.

umount <device_name>
hdiutil detach <device_name>

If you're really a neat freak, you can unload the kernel module, but it's not strictly necessary.

macOS 11+ (Big Sur)

sudo kmutil unload -p /System/Library/Extensions/cd9660.kext (maybe?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment