2 min read

Flashing a bootable USB from your shell

I find myself flashing ISOs to a USB drive from macOS every couple of months. Not often enough to remember the corresponding shell incantations, but just often enough to be frustrated that I don’t know them off the top of my head.

The method below works only on what are called hybrid ISOs, an image that has been prepared to work with both CDs and USB drives. It should cover most modern Linux distributions but will fail with windows and other obscure stuff.

Verify that you are working with a hybrid ISO

file path_to_img.iso # Look for mentions of a boot sector

Find the USB drive and unmount it before writing the ISO.

diskutil list
diskutil unmountDisk /dev/diskX

Burn the image and eject

dd if=path_to_img.iso of=/dev/diskX bs=4M status=progress
diskutil eject /dev/diskX