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.

@mikbor
Copy link

mikbor commented Oct 4, 2024

Thank you! Unfortunately my PC is really old and doesn't support UEFI. The USB won't boot. Any ideas how to adjust the steps to make it compatible with older PCs?

@gregorioosorio
Copy link

Thanks! It makes sense. I think there is a typo in the last command, it should be install.wim instead of install.swm, anyway thanks for your help!

@gregorioosorio
Copy link

OK, I see the extension swm is needed when split the files...

@recrof
Copy link

recrof commented Oct 11, 2024

@masonduug nope, that's not "flagged by apple", it just means developer did not pay apple app certificate.

@fuzulus
Copy link

fuzulus commented Oct 11, 2024

As mentioned in the earlier comments, you have to run mkdir -p /Volumes/WINDOWS10/sources.

I also had to do a mv /Volumes/WINDOWS10/CCCOMA_X64FRE_EN-GB_DV9/* . because the files were copied inside the dir instead of the root of the USB.

Also had to use legacy boot to get this to work.

Thank you author, this one saved the day for me! 😁

@nielsdevos19
Copy link

nielsdevos19 commented Oct 13, 2024

After a wasting a whole Sunday trying to make a bootable windows usb with all kinds of methods without success I found this method. It worked like a charm for me. I was worried that my usb flash 128gb 150m/s (15 euro) would not be good enough and need to buy a more expensive SSD. I use it only for 1 program (solidworks) and it works fine! Altough if I would have known it would take this much time I would have invested mor bucks for a real extern ssd with 500m/s speed.

Thank you so much for taking the effort to share these steps.

My system is iMac 2012.

@diafour
Copy link

diafour commented Oct 26, 2024

Thanks! Everything works on UEFI mb. Even without bootsector!

@bluegroper
Copy link


The magical command for when using a split:

$ mkdir /Volumes/WINDOWS10/sources

It seems the .../sources directory is already created by rsync command in Step 5 above.
Is that correct, or did I miss something important ?

@emanuelcosta-dev
Copy link

Just followed the instructions from start to finish and It worked perfectly. Thanks for making this!

@keedhost
Copy link

WinDiskWriter might be a malware and flagged by Apple.

093347

This will fix the issue:

sudo xattr -r -c  /Applications/WinDiskWriter.app

@nzjc
Copy link

nzjc commented Oct 28, 2024

this gist is the only thing that worked for me for win11. thanks!

@caiodv
Copy link

caiodv commented Nov 2, 2024

This saved my life, I spent a whole saturday trying to get windows installed thinking the issue was some bios setting (all I've found through google said so) and this was it, can't believe it was the way I set up the bootable usb

@diafour
Copy link

diafour commented Nov 3, 2024

@bluegroper Missing "sources" directory may be one of 2 things: either split performed before rsync, or a missing slash in the rsync command.

@Alexwi1son
Copy link

Alexwi1son commented Nov 14, 2024

This trick worked on my Intel MacBook Pro (i7 and 16GB RAM) on year ago. However, unable to get the splitting process finished on my new MacBook Air M3. Not sure what the problem is. Fortunately, I managed to create a Windows 11 bootable USB with the top ranked reply from Apple tech community:

https://discussions.apple.com/thread/255200443?sortBy=rank

If you had the same issue as me, I suggest giving it a try. No command prompt and less waiting time (~20 mins).

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