A macOS and Linux command-line USB formatting tool.
v0.1.0 · by Asfandyar Choudhary
| Format | Linux | macOS |
|---|---|---|
| ext4 | ✅ | ❌ |
| ext3 | ✅ | ❌ |
| ext2 | ✅ | ❌ |
| NTFS | ✅ | ✅ |
| exFAT | ✅ | ✅ |
| FAT32 | ✅ | ✅ |
| FAT16 | ✅ | ✅ |
| APFS | ❌ | ✅ |
- Python 3.6+
- Root / sudo privileges
sudo bash recast.sh --installOn Linux this also auto-installs all required formatting tools (ntfs-3g, dosfstools, exfatprogs, e2fsprogs, util-linux).
On macOS this prompts you to install macFUSE + ntfs-3g via Homebrew for full NTFS read/write support. If Homebrew is not installed, Recast will install it for you first.
sudo bash recast.sh --uninstall| Command | Action |
|---|---|
sudo bash recast.sh --install |
Install Recast |
sudo bash recast.sh --uninstall |
Uninstall Recast |
sudo bash recast.sh --help |
Show installer help |
python3 recast.py [options]recast # interactive mode
recast --list # list USB drives
recast --formats # show supported formats
recast --device /dev/sdb --format ext4 # format directly
recast --device /dev/sdb --format fat32 --label MYUSB # with label
recast --device /dev/sdb --format ntfs --yes # skip confirmation
recast --device /dev/sdb --format ext4 --dry-run # preview only
recast --version # show version
recast --help # full helpmacOS uses
/dev/diskN(e.g./dev/disk2), Linux uses/dev/sdX(e.g./dev/sdb). Always target the whole disk, not a partition (/dev/sdbnot/dev/sdb1).
| Flag | Description |
|---|---|
--list |
List all connected removable drives |
--device DEV |
Target device path |
--format FMT |
Filesystem format |
--label LABEL |
Volume label (default: USB_DRIVE) |
--yes |
Skip the YES confirmation prompt |
--dry-run |
Preview the command without executing |
--formats |
List formats supported on the current OS |
--version |
Show version and exit |
--help |
Show full help and exit |
- Refuses to format system/internal disks
- Always requires typing
YESto confirm — unless--yesis passed --dry-runlets you preview the exact command without running it
"Root privileges required"
Always run with sudo:
sudo recast --device /dev/sdb --format ext4"command not found: recast" after install
Your PATH may not include /usr/local/bin. Add it for your shell:
# zsh (macOS default)
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
# bash (Linux default)
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrcDrive not showing in --list (Linux)
Run lsblk to confirm the kernel sees the device. If it does, pass the path directly:
sudo recast --device /dev/sdb --format fat32Drive not showing in --list (macOS)
Open Disk Utility (Cmd+Space → "Disk Utility") to confirm macOS sees the drive. Try unplugging and replugging if not.
"mkfs.X not found" (Linux) Re-run the installer to auto-install missing tools:
sudo bash recast.sh --install"Could not unmount" (Linux) A file on the drive is open. Close it and retry, or force it:
sudo fuser -km /dev/sdb
sudo recast --device /dev/sdb --format ext4"diskutil unmountDisk failed" (macOS) A file on the drive is open in Finder or another app. Close it and retry.
NTFS write not working after install (macOS) macFUSE requires a system restart to activate. Reboot and try again.
This project is licensed under the GNU General Public License v3.0.