MacOS Terminal: Create a Bootable USB from an ISO Using “dd”

February 28, 2017 | Views: 47943

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

The .ISO file is a widely used disk image format and the standard format for bootable media. (Linux anyone?)

Here is a quick and easy way to make a bootable USB from a .ISO file, no 3rd party apps required.

Here are the terminal commands in order, followed by explanations of what they do:

Note: You’ll need to be an administrator to do this.

diskutil list

Lists out all disk drives and their volumes. Drives are labeled as disk0, disk1, disk2, etc. Volumes are labeled disk1s0, disk1s1, disk1s2, etc. For our purposes, we only care about the drive. In this case, we’re going to assume our flash drive is disk2.

diskutil unmountDisk disk2

The unmountDisk command unmounts all volumes of the given disk drive but keeps the drive itself visible to the computer (as opposed to the eject option that disconnects it entirely)

sudo dd if=/Users/kyle/Downloads/Linux.iso of=/dev/disk2 bs=8m

sudo” tells the system to use root level (that is the system’s highest level) privileges to perform the following action.

dd”  is an extremely basic, but powerful block level copy command built into all Linux and Unix operating systems (MacOS is UNIX based)

if” stands for input file (a.k.a the source file or location). In our use-case, this is the .ISO file. In MacOS, if you have a finder window open, you can drag and drop the .iso into the terminal and it will auto-fill this file path.

of” stands for “output file” (a.k.a the destination file or location). For us, this is our USB drive, disk2. The specific path for external drives is in “/dev”, hence /dev/disk2

bs” stands for block size. dd copies data in blocks rather than on a file by file basis (this is why it’s so fast) and this command gives you the option to set how big each block is. There is a science to the ideal block size, but I don’t know it. 8m (MegaBytes) has consistently worked well for my uses.

The command will not show any progress until it’s done, but you can press control+t for status updates. With an average computer, this takes less than 5min to complete.

Once complete:

diskutil eject disk2

The USB drive can now safely be removed. Assuming that the iso is EFI-compatible, you can reboot your mac to test it.

 

 

 

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
5 Comments
  1. Any tips if you can’t get your Mac to boot off the USB after following the dd write up? Tried it with several USB drive all with the same result. Using a Kali distro as the iso.

    • To boot off of a mac the iso needs to be efi compatible. Hold the option key upon startup and it should appear as “EFI Boot”.

      I just tested using a Sandisk UltraFlair and the Latest Kali LXDE iso. Works fine.

      On a side note, my understanding is that Mac started using EFi with 10.4. I assume that your mac is newer than that?

  2. Useful, very clear and thorough… great write-up, thanks 🙂

  3. Just a word of caution for people – DD is old and simple, but pretty powerful and unforgiving. It is best reading up exactly what it does and how to use it (around just copying and pasting a command) as a small error can break partitions and drives.

    • Very true! I love dd because it “just works” and is very fast, but even a tiny mistake with it and you can find yourself with a wiped drive. Honestly though, any command that requires “sudo” should be used with caution. There is a reason that admin privileges are need for said commands after all.

Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge

 

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel