Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lurepheonix/f0ca0c639d96828f722647065253c4dc to your computer and use it in GitHub Desktop.
Save lurepheonix/f0ca0c639d96828f722647065253c4dc to your computer and use it in GitHub Desktop.
# Creating Windows 10/11 Installation media on a Mac
## 1. Prepare your USB drive
1.1. Identify your USB drive name.
`diskutil list`
1.2. Format disk as GPT, where X is your drive number and WIN is the new device name.
`diskutil eraseDisk MS-DOS WIN GPT /dev/diskX`
1.3. Remove EFI volume from it, otherwise Windows installer (which is stupid) will complain that it can't install Windows on this USB and fail on install.
`diskutil eraseVolume "Free Space" EFI diskXs1`
## 2. Prepare an ISO.
2.1. Mount your Windows ISO file, where WINDOWS.iso is your filename.
`hdiutil mount WINDOWS.iso`
2.2. Cd to mounted-iso directory, where CCCOMA_X64FRE_EN-US_DV9 is the directory name.
`cd /Volumes/CCCOMA_X64FRE_EN-US_DV9`
2.3. Copy all files to your flash drive, except install.wim which is fatter than 4 GB, which is the limit for FAT32.
`rsync -avh --progress --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/ /Volumes/WIN`
2.4. Now we need to either split or compress install.wim.
First, install wimlib.
`brew install wimlib`
2.4.1. Split install.wim.
`wimlib-imagex split /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim /Volumes/WIN/sources/install.swm 3800`
2.4.2. Compress install.wim.
2.4.2.1. Copy file to desktop or other directory (ISO is read-only).
`cp sources/install.wim ~/Desktop/`
2.4.2.2. Compress install.wim.
`cd ~/Desktop/`
`sudo wimlib-imagex optimize install.wim --solid`
2.4.2.3. Copy compressed install.wim to USD drive.
`cp ~/Desktop/install.wim /Volumes/WIN/sources/`
Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment