Copy ISO to USB drive on MacOS

Posted on Fri 15 May 2020 in macosx

From time to time you need to create a bootable USB drive on macOS, for instance, to prepare a bootable Debian installer.

To do so, first, attach the USB storage to your computer that should be used as a target. Be aware that all data on that device will be deleted.

Subsequently, use the diskutil command to identify the corresponding volume.

diskutil list external

Locate the external, physical device in general at the end of the list that will usually be formatted as FAT32. Ensure that it matches the size of the device.

Let's assume for the following commands that the identified device is /dev/disk2, which is a common scenario. Nonetheless, double-check the specific volume on your computer to avoid unwanted data loss.

Then, unmount the identified disk using the following command:

sudo diskutil unmountdisk /dev/disk2

Download the desired ISO image e.g. a current Debian net installer. Subsequently, copy the ISO image to the USB device. This command will delete all data and cannot be undone!

sudo dd if=firmware-10.4.0-amd64-netinst.iso of=/dev/rdisk2 bs=1m && sync

By adding the 'r' before the volume name, the data will be written in raw mode, which should be faster. Depending on the size of the ISO and the speed of the USB interface this can take a couple of minutes.

When it is done, a popup will appear stating that the inserted disk is not readable. Simply click on the Eject button, remove the USB device from your computer. Now, it can be used in any other computer as a boot USB drive.