Skip to content

Instantly share code, notes, and snippets.

@acarril
Created November 18, 2022 17:49
Show Gist options
  • Save acarril/8c15f600cf0397dd61161a470f50f669 to your computer and use it in GitHub Desktop.
Save acarril/8c15f600cf0397dd61161a470f50f669 to your computer and use it in GitHub Desktop.
Create a bootable Windows USB using macOS

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.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

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

3. Format USB drive

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

4. Mount the Windows ISO and check its size

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

5. Copy (almost) all files to USB drive

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

6. Use wimlib to split and copy sources/install.wim

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.

@mordonez
Copy link

mordonez commented Dec 9, 2024

Thanks! very well explained

@armanafat
Copy link

armanafat commented Dec 12, 2024

if you had hard time finding the file in this </Volumes/...>, consider this that the file name can also start with CPBA .
worked like a charm ! thank you

@emanuelcosta-dev
Copy link

parallels sometimes has discounts https://prf.hn/l/znPzDkX, if you have chip m1,m2,m3 then you not have other alternatives, and https://hypestkey.com/product/windows-11-home/ - for windows 11 home retail keys microsoft partner, i play valorant without any problems with parallels

For activation just use massgravel MAS:
https://github.com/massgravel/Microsoft-Activation-Scripts
Works perfectly for any version with just one command.

@dominik-air
Copy link

Worked for a Windows 10 ISO on Apple Silicon MacBook. As others have mentioned above, make sure that you are copying files into the root directory of the usb disk.

@idhame
Copy link

idhame commented Dec 30, 2024

In today's world, it's probably better to use GPT instead of MBR when partitioning USB drives. At least, this option should be mentioned. Newer PCs tend to use UEFI by default and while it's usually possible to enable the legacy boot mode, it's just easier to create a GUID Partition Table in the first place. So

diskutil eraseDisk MS-DOS "WINDOWS10" GPT disk2

might be a preferable way to go.

This saved my life :) yes it only worked with me by using GPT option.

Be cautious when using GPT-formatted USB drives for fresh Windows 11 installations. Windows 11 installations can sometimes encounter issues when multiple drives are detected, particularly if the USB drive is also GPT-formatted. The installer might mistakenly identify the USB drive as a suitable system drive and place the crucial EFI partition on it. I have experienced this multiple times, resulting in a non-bootable PC unless the USB drive remains connected

@tauzN
Copy link

tauzN commented Dec 30, 2024

Just format as GPT ExFAT and the 4+ GB file fits just fine. What a waste of time.

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