Making a Bootable Linux USB Drive from an ISO on macOS (OSX)
Like a lot of things, macOS is a little different when it comes to making a bootable USB drive from an ISO file. The dd command in macOS is similar to the Linux dd command, but macOS wants the ISO file to be in IMG format before you can write it to the USB drive, so we’ll have to convert it.
For this example, I’ll put a file called linux.iso on my Desktop and all of the commands will reflect that location and my username, ‘jason.’ You may have to change the commands/paths to be correct for your situation. Commands are case sensitive, including filenames. Note that if you are familiar with Linux and have never used macOS before, you can use Tab autocomplete, which is nice.
- Download the desired file and put it on your desktop
- Open Terminal and run the command to convert the ISO to an IMG file.
hdiutil convert -format UDRW -o /Users/jason/Desktop/linux.img /Users/jason/Desktop/linux.iso
- This will create a file called linux.img on the desktop. If macOS puts a .dmg file extension on the file, it’s easy to rename:
mv /Users/jason/Desktop/linux.img.dmg /Users/jason/Desktop/linux.img
- Run ‘diskutil list’ to get a list of your currently mounted disk devices. It’s a good idea to unplug any USB hard drives or flash drives that you have plugged in EXCEPT the one you want to write to so you don’t accidentally over-write a device that you don’t want to. Using the dd command to write the IMG file will destroy everything on the target drive. YOU HAVE BEEN WARNED. Your USB disk will likely be called something like “/dev/disk2” Just check the output of the command to make sure. The rest of the guide will assume /dev/disk2 is correct.
- Your disk must be unmounted before you can write to it. To unmount it, use the following command:
diskutil unmountDisk /dev/disk2
- We can now write the IMG file to the USB drive. For Linux users, this may look familiar. Notice that after the of=, the name of the disk is written as “rdisk” instead of just “disk.” You can also use disk, but in macOS, rdisk is sort of a safety measure that tries to keep you from overwriting an internal disk by accident, since the “r” in “rdisk” means removable.
sudo dd if=/Users/jason/Desktop/linux.img of=/dev/rdisk2 bs=1m
- You will be asked to enter administrative credentials because of the sudo command. After that, there is no progress indicator for this command, just a solid cursor. Depending on the size of the ISO, the command can take a LONG time to write. Just let it go until it finishes. When finished, macOS will re-mount the drive. Be sure to unmount it by dragging it to the trash before removing the physical USB device.
Conclusion
If you enjoyed this tutorial and would like to see more, please feel free to share this article on social media, comment below letting me know what else you’d like to see, and follow me on Twitter @JROlmstead.