This guide shows how to use jaran.sh to prepare a USB installer for Windows on macOS. It covers prerequisites, safety checks, how the script works, customization, and troubleshooting.
Creating a Windows USB on macOS often fails when install.wim exceeds 4 GB, because FAT32 doesn’t support files that large. This script automatically splits the WIM into .swm parts using wimlib-imagex, while handling modern macOS quirks (read-only FAT32 mounts, Homebrew install, etc.).
- macOS (Intel or Apple Silicon)
- Windows ISO image (Win10/Win11 recommended)
- USB drive (8 GB+; will be erased)
- Admin rights for disk operations
git clone https://github.com/YOUR_USER/ai-job-apply.git
cd ai-job-apply
chmod +x jaran.shsudo ./jaran.shYou will be prompted to:
- Provide the path to your ISO if the default is wrong
- Choose the target USB disk (e.g.,
disk2) - Confirm the destructive erase step
The script will:
- Unmount and erase the USB as FAT32 (GPT by default)
- Mount the ISO
- Copy files with
rsync(excludinginstall.wiminitially) - If
install.wim≥ 4 GB, installwimlibif needed and split it toinstall.swm - Otherwise, copy
install.wimdirectly - Detach the ISO and eject the USB
Open jaran.sh and adjust the header variables:
ISO_PATH="$HOME/Downloads/win7.iso" # path to your ISO
USB_NAME="WINUSB" # volume label for the USB
WIM_SPLIT_CHUNK_MB=3800 # `.swm` part size (MB)
USE_GPT=true # false for MBRNotes:
- Use
USE_GPT=falseif you need legacy BIOS/MBR boot. UEFI systems typically work best with GPT. - Split size between 3000 and 4000 MB works well for FAT32.
- Double-check the selected disk in
diskutil listbefore confirming; the erase is destructive. - Close Finder windows that might auto-mount/eject the USB while the script runs.
- Use a reliable USB 3.0 or better drive to avoid copy errors.
Symptom: rsync fails due to read-only FAT32
- What happens: On newer macOS (Sonoma+), FAT32 sometimes mounts read-only.
- Fix: The script attempts a writable remount using
diskutilandmount -w -t msdos. If this still fails, try unplugging/re-plugging the USB and rerun.
Symptom: wimlib-imagex not found
- Fix: The script offers to install Homebrew if missing, then installs
wimlib. - Manual install:
brew install wimlib
Symptom: No sources/install.wim in ISO
- Fix: Use a Microsoft/official-style ISO. Some customized ISOs omit
install.wim.
Symptom: Target PC won’t boot USB
- For UEFI PCs: Ensure GPT partitioning (
USE_GPT=true). - For legacy BIOS PCs: Try
USE_GPT=falseto use MBR. - Use the system’s boot menu key (often F12, F8, Esc, or Del) to select the USB.
Symptom: Very slow copy
- Use a USB 3 port and a fast USB drive.
- Avoid copying through USB hubs.
After completion, the USB should contain a sources folder and either install.wim or install.swm parts. You can spot-check with:
ls -lah /Volumes/WINUSB/sourcesIf you publish jaran.sh as a Gist, you can run it directly:
bash <(curl -fsSL https://gist.githubusercontent.com/oyi77/b67179998bf8e4c0cae3d464293afa16/raw/jaran.sh)- Based on community recipes for preparing Windows USB installers on macOS
- Automations adapted for modern macOS and
wimlib-imagex