Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mackankowski/234956522119e98dac0647c96154cfe2 to your computer and use it in GitHub Desktop.
Save mackankowski/234956522119e98dac0647c96154cfe2 to your computer and use it in GitHub Desktop.
How to create a bootable Windows 7, 8, 10, 11 installer USB on macOS

How to create a bootable Windows 7, 8, 10, 11 installer USB on macOS

Run in Terminal:

  1. brew install wimlib - run, if wimlib is not installed yet (required for splitting large files)
  2. To identify target USB device, run: diskutil list
  3. Format USB drive: diskutil eraseDisk MS-DOS "$WIN_USB_NAME" MBR /dev/$DISK where $WIN_USB_NAME is a new volume name (e.g. WIN) and $DISK is a target disk identificator (e.g. disk5). Alternatively, you can try GTP partititon style instead of MBR (recommended for UEFI = newer Windows distributions)
  4. To mount Windows installer image, run: hdiutil mount ~/Desktop/$WIN_INSTALLER_IMAGE.iso where $WIN_INSTALLER_IMAGE is installer image name.
  5. Copy all files to the USB drive, beside the "install" file (if it's over 4GB size): rsync -vha --exclude=sources/install.$EXT /Volumes/$WIN_INSTALLER_NAME/ /Volumes/$WIN_USB_NAME where $EXT is wim or esd, $WIN_INSTALLER_NAME is the mounted Windows installer volume name and $WIN_USB_NAME is target disk name. For install file with less than 4GB size, run: rsync -vha /Volumes/$WIN_INSTALLER_NAME/ /Volumes/$WIN_USB_NAME (if so, skip steps no. 5 and 6)
  6. (Applicable for install file with esd extension when it's over 4GB size): Export the file to the local machine by: wimexport /Volumes/$WIN_INSTALLER_NAME/sources/install.esd all ~/Desktop/install.wim --compress=LZX where $WIN_INSTALLER_NAME is mounted Windows installer volume name. Remember to remove local copy of install file at the end of these steps.
  7. (Applicable when install file (both extensions) is over 4GB size): Copy remaining "install" file (splitted) onto the installer USB drive: wimlib-imagex split /Volumes/$WIN_INSTALLER_NAME/sources/install.wim /Volumes/$WIN_USB_NAME/sources/install.swm 4000 where $WIN_INSTALLER_NAME is mounted Windows installer volume name and $WIN_USB_NAME is target USB disk name. If Step 5 was executed, notice that the "install.wim" source directory will be different (e.g. wimlib-imagex split ~/Desktop/install.wim /Volumes/$WIN_USB_NAME/sources/install.swm 4000).
  8. Unmount installer volumes (local and physical).
  9. You USB drive is bootable now! 🚀

References

@minhdangoz
Copy link

thanks for sharing, I can create usb boot by following your guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment