For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.
You can download Windows 10 or Windows 11 directly from Microsoft.
After plugging the drive to your machine, identify the name of the USB device using diskutil list
, which should return an output like the one below. In my case, the correct disk name is disk2
.
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.3 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk1 500.0 GB disk0s2
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +500.0 GB disk1
Physical Store disk0s2
1: APFS Volume MacHDD - Data 180.3 GB disk1s1
2: APFS Volume MacHDD 15.4 GB disk1s2
3: APFS Snapshot com.apple.os.update-... 15.4 GB disk1s2s1
4: APFS Volume Preboot 481.8 MB disk1s3
5: APFS Volume Recovery 1.1 GB disk1s4
6: APFS Volume VM 1.1 GB disk1s5
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *15.5 GB disk2
1: DOS_FAT_32 WINDOWS10 15.5 GB disk2s1
Format the drive with the following command, substituting disk2
with whatever is the one that corresponds in your machine.
diskutil eraseDisk MS-DOS "WINDOWS10" MBR disk2
Mount the ISO file in your system (usually by simply double-clicking it), and verify it's listed in /Volumes
—the disk name usually starts with CCCOMA_
. With the disk mounted, check the size of the sources/install.wim
file with the following command:
ls -lh /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim
If sources/install.wim
is less than 4GB in size, you can copy all the files from the mounted disk image onto the USB drive with the following command (notice the trailing slash in the first path!):
rsync -avh --progress /Volumes/CCCOMA_X64FRE_EN-US_DV9/ /Volumes/WINDOWS10
If sources/install.wim
is more than 4GB, then we'll need to split the file before copying it. In the meantime, we can copy all the other files from the mounted image onto the USB drive with the following command (again, notice the trailing slash in the first path!):
rsync -avh --progress --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/ /Volumes/WINDOWS10
If sources/install.wim
is more than 4GB, it is too large to copy onto a FAT32-formatted drive. Microsoft's official solution is to split the file, and there is a free utility available in macOS and Linux to do so—wimlib
. The tool can be installed with Homebrew:
brew install wimlib
After installing wimlib
, split and copy sources/install.wim
using the following command:
wimlib-imagex split /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim /Volumes/WINDOWS10/sources/install.swm 3800
Here, 3800
means that the file should be split in 3,800MB chunks.
`#!/bin/bash
Variables
ISO_PATH="$HOME/Downloads/Win11_English_x64.iso" # Update with your ISO file path
USB_NAME="WIN11_USB" # Desired name for the USB drive
USB_SIZE=16 # Minimum USB size in GB
Check if ISO file exists
if [ ! -f "$ISO_PATH" ]; then
echo "ISO file not found at $ISO_PATH"
exit 1
fi
List all disks and prompt user to select the USB drive
echo "Available disks:"
diskutil list
read -p "Enter the identifier of your USB drive (e.g., disk2): " DISK_IDENTIFIER
Confirm the selected disk
read -p "You have selected /dev/$DISK_IDENTIFIER. All data on this drive will be erased. Continue? (y/n): " CONFIRM
if [ "$CONFIRM" != "y" ]; then
echo "Operation aborted."
exit 1
fi
Unmount the disk
diskutil unmountDisk /dev/$DISK_IDENTIFIER
Format the USB drive as FAT32 with MBR
diskutil eraseDisk MS-DOS "$USB_NAME" MBR /dev/$DISK_IDENTIFIER
Mount the Windows 11 ISO
hdiutil mount "$ISO_PATH"
Get the mounted ISO volume name
ISO_VOLUME=$(ls /Volumes | grep "CCCOMA_X64FRE")
Copy files from ISO to USB, excluding install.wim
rsync -avh --exclude=sources/install.wim /Volumes/"$ISO_VOLUME"/ /Volumes/"$USB_NAME"
Install Homebrew if not present
if ! command -v brew &> /dev/null; then
echo "Homebrew not found. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
Install wimlib
brew install wimlib
Split install.wim into smaller files
wimlib-imagex split /Volumes/"$ISO_VOLUME"/sources/install.wim /Volumes/"$USB_NAME"/sources/install.swm 4000
Unmount ISO and USB
hdiutil unmount /Volumes/"$ISO_VOLUME"
diskutil eject /dev/$DISK_IDENTIFIER
echo "Bootable Windows 11 USB created successfully."
`
chmod +x create_win11_usb.sh
./create_win11_usb.sh