How to create a Windows USB Stick on macOS/Linux
In this post, I’ll describe how you can create a bootable Windows installation USB drive using macOS (and Linux too).
Please note that this guide is written primarily for macOS, you might need to adapt some parts on Linux. Disk Utility, for example, is not available on Linux, but you can replace it with gparted or a command line tool to achive the same effect.
Prerequisites
You’ll have to have the following:
- A
.iso
file of the version of Windows you want to install - A USB drive, 8GB should be enough
- wimlib
- rsync
Creating the USB drive
You can create the USB drive by using the following steps:
- Open Disk Utility and Erase the USB drive
- You might need to use “View > Show All Devices” in order to see the target drive itself instead of the volume
- Use FAT as partition format, and MBR instead of GUID
- Mount the iso using the following command:
hdiutil mount /path/to/windows.iso
- Replace
/path/to/windows.iso
with the actual path of the.iso
file
- Copy the iso contents to the drive:
rsync -vha --exclude=sources/install.wim /Volumes/NAME_OF_ISO/* /Volumes/TARGET_DRIVE
- Replace
NAME_OF_ISO
with the name of the mounted volume (visible in Finder or Disk Utility) - Replace
TARGET_DRIVE
with the name of the target drive volume (also visible in Finder or Disk Utility)
- Rebuild/split the
install.wim
archive:wimlib-imagex split /Volumes/NAME_OF_ISO/sources/install.wim /Volumes/TARGET_DRIVE/sources/install.swm 3800
- Replace
NAME_OF_ISO
with the name of the mounted volume (visible in Finder or Disk Utility) - Replace
TARGET_DRIVE
with the name of the target drive volume (also visible in Finder or Disk Utility)
- Unmount the target drive and use it to boot the Windows installer