Skip to content

Instantly share code, notes, and snippets.

@mamiu
Last active October 11, 2021 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamiu/a62086858a78441895d0953b17617e2b to your computer and use it in GitHub Desktop.
Save mamiu/a62086858a78441895d0953b17617e2b to your computer and use it in GitHub Desktop.
Create bootable USB stick from an ISO image on macOS

Create bootable USB stick from an ISO image on macOS

If you want to create a bootable USB stick for Windows (Windows 10/11 installation media) have a look at this guide.

  1. Download the desired ISO file

  2. Open a terminal application (like the Apple Terminal or iTerm)

  3. Convert the .iso image to a .dmg file (UDIF image) using the convert option of hdiutil:

hdiutil convert -format UDRW -o /path/to/target /path/to/source.iso

hdiutil will put the .dmg file extension to the output file automatically.

  1. Get the current list of devices
diskutil list
  1. Insert your USB stick

  2. Run the command from step 4 again to determine the device disk assigned to your USB stick (e.g. /dev/disk2)

diskutil list
  1. Unmount that disk

Note: In the next commands you have to replace N with the disk number you've determined in the last command (in the previous example, N would be 2).

diskutil unmountDisk /dev/diskN
  1. Burn the .dmg image to the flask disk. Replace /path/to/converted-iso.dmg with the path where the converted ISO image file is located (e.g. ~/Downloads/ubuntu.dmg).
sudo dd if=/path/to/converted-iso.dmg of=/dev/rdiskN bs=1m status=progress

Note: If you see the error dd: Invalid number '1m' you are using GNU dd. Use the same command but replace bs=1m with bs=1M.

Note: Using /dev/rdisk instead of /dev/disk may be faster.

  1. Eject the flash disk and remove it when the command completes
diskutil eject /dev/diskN
  1. Now the USB stick is ready. You can boot any device from it by plugging it in, start the device, change the boot order in the BIOS or open the boot device menu and select the USB stick.
@mamiu
Copy link
Author

mamiu commented Oct 1, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment