Skip to content

Instantly share code, notes, and snippets.

@pattersongp
Last active May 29, 2020 01:47
Show Gist options
  • Save pattersongp/803393851576f13d78affcc2d41a97e0 to your computer and use it in GitHub Desktop.
Save pattersongp/803393851576f13d78affcc2d41a97e0 to your computer and use it in GitHub Desktop.
Installing Ubuntu onto a USB from MacOS

Installing Ubuntu onto USB on MacOS

You'll need:

  • An Ubuntu ISO downloaded from here
  • USB stick
  1. $ hdiutil convert -format UDRW ~/Downloads/ubuntu-18.04.1-desktop-amd64.img -o ~/Downloads/ubuntu-18.04.1-desktop-amd64.iso
  2. $ diskutil unmountDisk /dev/disk3
  3. $ sudo dd if=~/Downloads/ubuntu-18.04.1-desktop-amd64.img.dmg of=/dev/rdisk3 bs=1m
  4. $ diskutil eject /dev/disk3

Convert the iso a bootable image using hdiutil

user:~$ hdiutil convert -format UDRW -o ~/Downloads/ubuntu-18.04.1-desktop-amd64.img ~/Downloads/ubuntu-18.04.1-desktop-amd64.iso
Reading Driver Descriptor Map (DDM : 0)…
Reading Ubuntu 18.04.1 LTS amd64         (Apple_ISO : 1)…
Reading Apple (Apple_partition_map : 2)…
Reading Ubuntu 18.04.1 LTS amd64         (Apple_ISO : 3)…
.............................................................................
Reading EFI (Apple_HFS : 4)…
.............................................................................
Reading Ubuntu 18.04.1 LTS amd64         (Apple_ISO : 5)…
..............................................................................
Elapsed Time: 18.745s
Speed: 99.4Mbytes/sec
Savings: 0.0%
created: /Users/user/Downloads/ubuntu-18.04.1-desktop-amd64.img.dmg

Find your USB stick that's mounted on the machine:

user:~$ diskutil list
/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *3.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                 Apple_APFS Container disk2         3.0 TB     disk1s2
...

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *30.8 GB    disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:       Microsoft Basic Data UBUNTU                  30.5 GB    disk3s2

Then you'll unmount it and use dd to write the image to the USB


user:~$ diskutil unmountDisk /dev/disk3
Unmount of all volumes on disk3 was successful

user:~$ sudo dd if=~/Downloads/ubuntu-18.04.1-desktop-amd64.img.dmg of=/dev/rdisk3 bs=1m
Password:
1862+1 records in
1862+1 records out
1953349632 bytes transferred in 143.480153 secs (13614075 bytes/sec)

Finally, eject the disk and you'll be able to boot into the install menu

user:~$ diskutil eject /dev/disk3
Disk /dev/disk3 ejected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment