avatar

Andres Jaimes

Create a bootable FreeBSD or Ubuntu USB flash drive on Mac/OS-X

By Andres Jaimes

- 3 minutes read - 473 words

This article provides step-by-step instructions on how to create a bootable USB flash drive for either FreeBSD or Ubuntu operating systems. The post includes the necessary commands to download and transfer the installation files onto the USB drive using the terminal on a macOS system. The author also includes a reference link for creating a FreeBSD installation memstick on macOS.

Download the files

Start by downloading the installation file for the operating system you want to install. For FreeBSD, you can download the amd64/memstick installation file from the FreeBSD website. For Ubuntu, you can download the desktop installation file from the Ubuntu website.

Prepare the USB flash drive

Insert a memory stick into your computer and open a terminal window. Type the following command to list the available disks on your system:

 1~ $ diskutil list
 2/dev/disk0 (internal, physical):
 3#:                       TYPE NAME                    SIZE       IDENTIFIER
 40:      GUID_partition_scheme                        *500.3 GB   disk0
 51:             Apple_APFS_ISC Container disk2         524.3 MB   disk0s1
 62:                 Apple_APFS Container disk3         494.4 GB   disk0s2
 73:        Apple_APFS_Recovery Container disk1         5.4 GB     disk0s3
 8
 9/dev/disk3 (synthesized):
10#:                       TYPE NAME                    SIZE       IDENTIFIER
110:      APFS Container Scheme -                      +494.4 GB   disk3
12Physical Store disk0s2
131:                APFS Volume Macintosh HD            9.1 GB     disk3s1
142:              APFS Snapshot com.apple.os.update-... 9.1 GB     disk3s1s1
153:                APFS Volume Preboot                 4.7 GB     disk3s2
164:                APFS Volume Recovery                778.1 MB   disk3s3
175:                APFS Volume Data                    206.1 GB   disk3s5
186:                APFS Volume VM                      20.5 KB    disk3s6
19
20/dev/disk4 (external, physical):
21#:                       TYPE NAME                    SIZE       IDENTIFIER
220:      GUID_partition_scheme                        *7.7 GB     disk4
231:                        EFI EFI                     209.7 MB   disk4s1
242:       Microsoft Basic Data UBUNTU                  7.5 GB     disk4s2

Look for the one that reads external, physical and has a size that closely matches your memory stick. In this case, the USB flash drive is /dev/disk4. Unmount the disk by typing the following command, but do not remove the USB flash drive from your computer yet:

1~ $ diskutil unmountDisk /dev/disk4
2Unmount of all volumes on disk4 was successful

Transfer the installation files

We’ll now copy the installation files onto the USB flash drive.

cd to your home directory. Our installation file is located in the Downloads directory. Type the following command to copy the installation file onto the USB flash drive. The process took about 20 minutes in my computer.

1~ $ sudo dd if=Downloads/ubuntu-22.04.2-desktop-amd64.iso of=/dev/disk4 bs=1m
24699+1 records in
34699+1 records out
44927586304 bytes transferred in 1362.203712 secs (3617364 bytes/sec)
  • if is the input file, which is the installation file.
  • of is the output file, which is the USB flash drive, identified as /dev/disk4.

Eject the USB flash drive when the process is complete:

1~ $ diskutil eject /dev/disk4
2Disk /dev/disk4 ejected

At this point, you can remove the USB flash drive from your computer and use it to install the operating system on another computer.

References