Skip to content

Instantly share code, notes, and snippets.

@mahfuz10
Forked from abelcallejo/README.md
Created March 3, 2024 03:31
Show Gist options
  • Save mahfuz10/069e2fd92f2f5775d58197ef7fbbd90b to your computer and use it in GitHub Desktop.
Save mahfuz10/069e2fd92f2f5775d58197ef7fbbd90b to your computer and use it in GitHub Desktop.
Create bootable Linux USB using Mac

Create bootable Linux USB using Mac

1. Prepare the .iso file

Download it, copy it, whatever it takes to prepare that Linux OS .iso file

2. Convert the .iso file into a .img.dmg

hdiutil convert -format UDRW -o linux.img linux.iso

Output

Reading Master Boot Record (MBR : 0)…
Reading CentOS 7 x86_64                  (Apple_ISO : 1)…
Reading  (Type EF : 2)…
Reading CentOS 7 x86_64                  (Apple_ISO : 3)…
.........................................................
Elapsed Time: 30.450s
Speed: 143.7Mbytes/sec
Savings: 0.0%
created: /tmp/linux.img.dmg

3. List the drives of the Mac

diskutil list

Output

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         500.1 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.1 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            446.8 GB   disk1s1
   2:                APFS Volume Preboot                 37.9 MB    disk1s2
   3:                APFS Volume Recovery                519.0 MB   disk1s3
   4:                APFS Volume VM                      3.2 GB     disk1s4

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.4 GB    disk2
   1:             Windows_FAT_32 NO NAME                 31.4 GB    disk2s1

Make sure to note the device that identifies the flash drive. In this case it is /dev/disk2

4. Unmount the flash drive

diskutil unmountDisk /dev/disk2

5. Copy the .img.dmg to the flash drive

time sudo dd if=linux.img.dmg of=/dev/disk2 bs=1m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment