A small Python utility to create a bootable USB from an ISO on macOS.
This script enumerates available disks, prompts for a target USB disk identifier (e.g. disk4) and the path to an ISO image, then writes the image to the selected disk and ejects it when finished.
- macOS host (uses macOS disk utilities)
- Python 3
- A terminal with sufficient privileges (writing an entire disk will require sudo)
Writing an ISO to a disk will erase all data on the selected device. Verify the target disk identifier carefully before proceeding. The author is not responsible for data loss.
- Save the script as
create_bootable_usb.pyin a convenient directory.
From the directory containing the script:
-
Make the script executable: chmod +x create_bootable_usb.py
-
Run the script (use
sudoif required): ./create_bootable_usb.py or sudo ./create_bootable_usb.py -
Follow the on-screen prompts:
- The script will list available disks.
- Enter the USB disk identifier (e.g.
disk4) when prompted. - Enter the full path to the ISO (e.g.
/Users/you/Downloads/ubuntu-24.04.iso). - The script will write the ISO to the disk and automatically eject it when complete.
- Disk identifier:
disk4 - ISO path:
/Users/you/Downloads/ubuntu-24.04.iso
- "Permission denied": Rerun the script with
sudo. - Disk not listed: Ensure the USB is connected and try
diskutil listto verify the identifier. - Slow writes: Writing large ISOs can take time; check activity with
Activity Monitororiostat.
Use at your own risk. No warranty provided.
# Bootable USB Creator (macOS)
A small Python utility to create a bootable USB from an ISO on macOS.
## Overview
This script enumerates available disks, prompts for a target USB disk identifier (e.g. `disk4`) and the path to an ISO image, then writes the image to the selected disk and ejects it when finished.
## Requirements
- macOS host (uses macOS disk utilities)
- Python 3
- A terminal with sufficient privileges (writing an entire disk will require sudo)
## Safety warning
Writing an ISO to a disk will erase all data on the selected device. Verify the target disk identifier carefully before proceeding. The author is not responsible for data loss.
## Installation
1. Save the script as `create_bootable_usb.py` in a convenient directory.
## Usage
From the directory containing the script:
1. Make the script executable:
chmod +x create_bootable_usb.py
2. Run the script (use `sudo` if required):
./create_bootable_usb.py
or
sudo ./create_bootable_usb.py
3. Follow the on-screen prompts:
- The script will list available disks.
- Enter the USB disk identifier (e.g. `disk4`) when prompted.
- Enter the full path to the ISO (e.g. `/Users/you/Downloads/ubuntu-24.04.iso`).
- The script will write the ISO to the disk and automatically eject it when complete.
## Example
- Disk identifier: `disk4`
- ISO path: `/Users/you/Downloads/ubuntu-24.04.iso`
## Troubleshooting
- "Permission denied": Rerun the script with `sudo`.
- Disk not listed: Ensure the USB is connected and try `diskutil list` to verify the identifier.
- Slow writes: Writing large ISOs can take time; check activity with `Activity Monitor` or `iostat`.
## License
Use at your own risk. No warranty provided.