This tutorial will go over the steps required to make a bootable Linux USB drive from macOS. We will be using the built in ‘dd’ command to do this. This tutorial is going to take place in the macOS terminal app. I will be using an ISO of CentOS 8, but any other Linux distribution will be the same steps.

Getting Started:

For this tutorial, I will be using a CentOS 8 ISO that you can download here. You can use any distro ISO that you would like, the steps will be the same. Make sure you are using an admin account for this since we will need root privileges later on.

First we need to open the macOS terminal app. This is in your Applications folder under Utilities > Terminal

Once the terminal is opened, let’s see what disks are currently attached to the system (don’t insert your USB yet). We are going to use the ‘diskutil’ command to list current disks on the system

In the terminal type in ‘diskutil list’

vulnifo@MacbookPro ~ % diskutil list

Your output should look similar to this.

vulnifo@MacbookPro ~ % diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         500.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            11.3 GB    disk1s1
   2:                APFS Volume Macintosh HD - Data     274.3 GB   disk1s2
   3:                APFS Volume Preboot                 82.8 MB    disk1s3
   4:                APFS Volume Recovery                529.0 MB   disk1s4
   5:                APFS Volume VM                      3.2 GB     disk1s5

These are Apples default disks for the APFS filesystem.
Now insert the USB drive into the Mac, and run the command again. This time, you will see a new disk at the bottom.

vulnifo@MacbookPro ~ % diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         500.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            11.3 GB    disk1s1
   2:                APFS Volume Macintosh HD - Data     274.3 GB   disk1s2
   3:                APFS Volume Preboot                 82.8 MB    disk1s3
   4:                APFS Volume Recovery                529.0 MB   disk1s4
   5:                APFS Volume VM                      3.2 GB     disk1s5

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *15.7 GB    disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:       Microsoft Basic Data UNTITLED                15.5 GB    disk2s2

As you see, I now have a new disk at ‘/dev/disk2’ which is an External, Physical drive (USB drive).

In the terminal, we now want to change directories to the location of our ISO. In my case, its in my download folder. There are a few ways to achieve this; using the ‘cd’ command, the full location for our Downloads folder is ‘/Users/yourusername/Downloads/’

First way,

vulnifo@MacbookPro ~ % cd /Users/yourusername/Downloads

The second way, which I used, is a shortcut by starting your command with ‘~/’

This way it knows to stay in the current users directory and access files from that user. Both commands end up at the same place, so choose whichever you are more comfortable with.

vulnifo@MacbookPro ~ % cd ~/Downloads
vulnifo@MacbookPro Downloads %     

You will notice that ‘Downloads’ (or whatever folder you went to for your ISO) now shows up after your name at the prompt, which means we are inside of the downloads folder. You can use the ‘ls’ command to see the contents of this folder and make sure that your ISO is inside of it.

vulnifo@MacbookPro Downloads % ls
CentOS-8.2.2004-x86_64-dvd1.iso
vulnifo@MacbookPro Downloads %

Now, we want to “unmount” our USB drive, so that we can prepare it for writing.


vulnifo@MacbookPro Downloads % diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

Make sure that you change “disk2” to match what disk number showed on your system as the USB drive.

The next command is going to be the actual ‘dd’ command that will write (or “burn”) our ISO image to the USB drive.

vulnifo@MacbookPro Downloads % sudo dd if=CentOS-8.2.2004-x86_64-dvd1.iso of=/dev/rdisk2 bs=1m

Let me break this command down.

  • sudo – super user do – This is used because the dd command requires super user (root) permissions in order to write the changes.
  • dd – This is the command (program) that we are invoking.
  • if= – This stands for ‘Input File’ which is the file (our ISO) that we want to be written TO disk.
  • of= – This stands for ‘Output File’ which means where the data is being written TO (which in our case is our USB drive location). Notice how I put ‘r’ in front of disk2. This modifier uses the raw disk which speeds up the write process. The ‘r’ is NOT required, and the command can simply be ‘of=/dev/disk2’
  • bs= – This defines the block size we want to use for our write. Setting this value to ‘1m’ will speed up the write process.

After this command it will ask for your password. The password is required for root access (this can only be done from an admin account). Please note, the password will NOT show up while you are typing. After entering the password and pressing “return,” the terminal will not read a new line. It will show blank space under where you entered the password.

Don’t worry, it will take some time depending on how big the ISO file is. When it is finished, the terminal will display lines similar to this.

7850+0 records in
7850+0 records out
8231321600 bytes transferred in 1730.748889 secs (4755931 bytes/sec)
vulnifo@MacbookPro Downloads %

And a popup will also show up on the screen telling you the disk is not readable by this computer.

When this pops up the only button you need to select is ‘Ignore’

Back to the terminal, unmount the USB drive.

vulnifo@MacbookPro Downloads % diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful

And there you have it! Remove the USB from the computer and you are all set.

I hope you’ve found this tutorial helpful. Any questions or comments feel free to comment below. Thanks and see you next time!

For more tutorials, please view our main archive here.

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply