avatar

Andres Jaimes

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

By Andres Jaimes

- 3 minutes read - 471 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:

~ $ diskutil list
/dev/disk0 (internal, physical):
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      GUID_partition_scheme                        *500.3 GB   disk0
1:             Apple_APFS_ISC Container disk2         524.3 MB   disk0s1
2:                 Apple_APFS Container disk3         494.4 GB   disk0s2
3:        Apple_APFS_Recovery Container disk1         5.4 GB     disk0s3

/dev/disk3 (synthesized):
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      APFS Container Scheme -                      +494.4 GB   disk3
Physical Store disk0s2
1:                APFS Volume Macintosh HD            9.1 GB     disk3s1
2:              APFS Snapshot com.apple.os.update-... 9.1 GB     disk3s1s1
3:                APFS Volume Preboot                 4.7 GB     disk3s2
4:                APFS Volume Recovery                778.1 MB   disk3s3
5:                APFS Volume Data                    206.1 GB   disk3s5
6:                APFS Volume VM                      20.5 KB    disk3s6

/dev/disk4 (external, physical):
#:                       TYPE NAME                    SIZE       IDENTIFIER
0:      GUID_partition_scheme                        *7.7 GB     disk4
1:                        EFI EFI                     209.7 MB   disk4s1
2:       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:

~ $ diskutil unmountDisk /dev/disk4
Unmount 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.

~ $ sudo dd if=Downloads/ubuntu-22.04.2-desktop-amd64.iso of=/dev/disk4 bs=1m
4699+1 records in
4699+1 records out
4927586304 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:

~ $ diskutil eject /dev/disk4
Disk /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