Skip to content

Instantly share code, notes, and snippets.

@jpesce
Last active September 17, 2020 13:58
Show Gist options
  • Save jpesce/fd175bab08412f69bb5dba7bbf0782ce to your computer and use it in GitHub Desktop.
Save jpesce/fd175bab08412f69bb5dba7bbf0782ce to your computer and use it in GitHub Desktop.
[Bootable USB in MacOS] Create a bootable Linux USB in MacOS

How to create a bootable USB stick in MacOS

Download the ISO

This is just and example for an arbitrary Arch Linux iso, always check for latest version and best mirror for you in https://www.archlinux.org/download/ or on the website of your distribution of choice.

curl http://br.mirror.archlinux-br.org/iso/2020.09.01/archlinux-2020.09.01-x86_64.iso -o archlinux-2020.09.01-x86_64.iso -#

Convert the ISO to UDRW Format

hdiutil convert -format UDRW -o archlinux-2020.09.01-x86_64 archlinux-2020.09.01-x86_64.iso

Flash the image on the USB

First, find out the USB drive identifier

diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:          Apple_CoreStorage                         399.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   5:                 Apple_Boot Boot OS X               134.2 MB   disk0s5
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS MacOSX                 *399.2 GB   disk1
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 GB     disk2
   1:       Microsoft Basic Data UNTITLED 1              2.0 GB     disk2s1

In the above example our 2GB USB stick is in /dev/disk2.

Now, partition the drive

diskutil partitionDisk /dev/disk2 1 "Free Space" "unused" "100%"

Transfer the image to the USB drive (Note: you'll probably need sudo for this. Note 2: there is no progress bar)

dd if=archlinux-2020.09.01-x86_64.dmg of=/dev/disk2 bs=1m

Finally, eject the drive

diskutil eject /dev/disk2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment