Write an ISO image file to USB stick from macOS

I want to set up an OPNsense firewall on my MSI Cubi N microcomputer. First of all, I need a bootable USB stick. Since I use a non-privileged user on my MacBook, things get a bit more complicated…

Download the Installer: https://opnsense.org/download/
File: OPNsense-24.7-vga-amd64.img.bz2
Now, let’s open the terminal and continue there. Determine the SHA256 checksum and compare it with the checksum provided on the download page:

shasum -a 256 OPNsense-24.7-vga-amd64.img.bz2

Copy the ISO image file to the admin user that has more access rights:

cp OPNsense-24.7-vga-amd64.img.bz2 /Users/admin/Public/Drop\ Box/

Login as the admin user:

su admin

Move to the drop box directory of the admin user. WordPress or my server doesn’t allow me to enter the command with path here…

Unpack the image:

bunzip2 OPNsense-24.7-vga-amd64.img.bz2

Insert the USB stick and determine its path by running the mount command:

mount

The output of the mount command shows, that the USB stick is assigned on my system to /dev/disk2

/dev/disk2 (external, physical):
...

And here is an alternative method to determine the mounting:

diskutil list
diskutil unmountDisk /dev/disk2
diskutil list

Write the image to the USB stick. Note that the path of the USB stick determined previously is changed: /dev/disk2/dev/rdisk2

sudo dd if=OPNsense-24.7-vga-amd64.img of=/dev/rdisk2 bs=64k

And the output is:

39955+1 records in
39955+1 records out
2618501632 bytes transferred in 512.309291 secs (5111173 bytes/sec)

Eject the USB stick and use it to set up the OPNsense firewall.

References

Leave a Reply

Your email address will not be published. Required fields are marked *