Thursday, October 07, 2021

Creating Windows/Linux bootable USB in Mac OSX from ISO image (command line)



1. Locate the USB disk you are using. My example (/dev/disk4) is shown below.

# diskutil list
...
/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *61.5 GB    disk4
   1:                 DOS_FAT_32 ⁨USB64G⁩                  61.5 GB    disk4s1

2. Erase and partition the USB disk.

# diskutil partitionDisk /dev/disk5 GPT "Free Space" x 0

3. Unmount the USB disk.

# unmountDisk /dev/disk4

5. Convert ISO image to DMG image.

# hdiutil convert -format UDRW -o ubuntu ubuntu-20.04.3-desktop-amd64.iso

6. Create the bootable USB disk.

# sudo dd if=ubuntu.dmg of=/dev/disk4 bs=1m