Skip to content

Instantly share code, notes, and snippets.

@lukepearson
Last active March 15, 2022 15:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukepearson/e175f288277ca6ff93e65cf6a3abf7cb to your computer and use it in GitHub Desktop.
Save lukepearson/e175f288277ca6ff93e65cf6a3abf7cb to your computer and use it in GitHub Desktop.
Create a bootable Windows 10 USB on MacOS
# Download the Windows 10 ISO
wget -O ~/Downloads/Windows10.iso https://software-download.microsoft.com/db/Win10_20H2_English_x64.iso?t=5f918d78-0088-47d5-adf9-8ccab64f2d3d&e=1604157841&h=675f0ae3a5a95da69c777d0d7031b8ec
# Mount the downloaded Windows 10 ISO
hdiutil mount ~/Downloads/Windows10.iso
# /dev/disk2 /Volumes/CCCOMA_X64FRE_EN-US_DV9
# Insert the USB stick (Minimum 8GB)
# Find the USB volume
diskutil list
# /dev/disk3 (external, physical):
# #: TYPE NAME SIZE IDENTIFIER
# 0: FDisk_partition_scheme *16.4 GB disk3
# 1: DOS_FAT_32 BOOT 16.4 GB disk3s1
# Erase the volume
diskutil eraseDisk MS-DOS "BOOT" MBR disk3
# Copy the files from the ISO to the first partition except for the 4gb one
rsync -av --progress /Volumes/CCCOMA_X64FRE_EN-US_DV9/ /Volumes/BOOT/ --exclude sources/install.wim
# Split the install.wim file into several smaller files so that they fit on the FAT32 partition
split -b 3700m /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim /Volumes/BOOT/sources/install.wim
# Unmount both the USB and ISO volumes
diskutil unmountDisk /dev/disk2
diskutil unmountDisk /dev/disk3
# Plug your usb into your other computer and install Windows
# It will complain that install.wim is not found
# Select Repair your computer -> Troubleshoot -> Command Prompt
# The diskpart commands below are from
# https://www.tenforums.com/tutorials/95941-diskpart-how-partition-gpt-disk.html
diskpart
list disk
# Choose the disk you want to format
# Disk ### Status Size Free Dyn Gpt
# -------- ------ ----- ------ --- ---
# Disk 2 Online 953GB 1024KB *
select disk 2
clean
convert gpt
create partition efi size=100
format quick fs=fat32 label="System"
create partition msr size=16
create partition primary
shrink minimum=450
format quick fs=ntfs label="Windows 10"
assign letter="W"
create partition primary
format quick fs=ntfs label="WinRE"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
# Copy the files to the new partition
xcopy F:\ W:\ /f /j /s /w /z
W:
cd sources
# Combine the install parts into a single file
type install.wimaa install.wimab > install.wim
del install.wimaa
del install.wimab
# Turn off the computer and remove the USB, then start it again and install windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment