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.

@marcloeb
Copy link

Thanks, worked for me!

@OnurGuersoy
Copy link

For those who are not familiar with command line or unable to install Homebrew, you can set up a Windows 10 virtual machine on your Mac and use the Media Creation Tool from Microsoft to create a Windows 10 or Windows 11 bootable USB. Alternatively, you can try WinBootMate app on your Mac to do the job. It has a built-in feature to split the install.wim file. Here is the screenshot:

winbootmate mac

Don't believe those guys ;)

@dmi-try
Copy link

dmi-try commented Apr 8, 2024

WinBootMate, WonderISO, UUByte iso editor and other clones of the very same app are scam. They ask you for money at the very last step.

Thank you for the instruction.

@dmi-try
Copy link

dmi-try commented Apr 9, 2024

Scam comes in many forms. Why make the same application under a bunch of names? Why hide the cost of $40 in all the instructions? Why write "try it free" in all forums and documentation? Why tell the user the price only when they have downloaded, installed, launched, entered the parameters and clicked "run"? The trial version is completely useless and does not communicate in any way until the last moment that it is trial. Additionally, I've seen complaints online from someone who couldn't get a refund, but it's unknown what actually happened there.

@TechUnRestricted
Copy link

There is no need to pay or use the Terminal / Parallels in order to create a bootable USB drive on macOS.

WinDiskWriter

There were no free "Rufus, but for mac" alternative, so I ended up crafting WinDiskWriter as a solution.

  • Open Source:
    Check the code, fork it, improve it.
  • App Compatibility:
    From Mac OS X Snow Leopard to Sonoma, Intel or Apple silicon, it's got you covered.
  • Supports a lot of Windows ISOs:
    Windows 11 / 10 / 8.1 / 8 / 7 / Vista, UEFI & Legacy.
  • UEFI & Legacy boot modes
    (Thanks, grub4dos developers!)
  • x64 & x32 (x86) Architectures
  • Supports TPM & Secure Boot Requirements patching

It's completely free!
But I appreciate donations 🥺

You can download it from my GitHub repo: https://github.com/TechUnRestricted/WinDiskWriter

Instructions? Yes!: TechUnRestricted/WinDiskWriter#4

@derrandz
Copy link

derrandz commented May 7, 2024

This did it for me, thank you

@TechUnRestricted
Copy link

Happy it worked for you 👍

@derrandz
Copy link

@dalori
Copy link

dalori commented Jun 4, 2024

@acarril Thanks for sharing. This one worked perfectly well on Mac OS 14.5 Sonoma and Windows 11.

@meszaroszoltan
Copy link

WonderISO is scam, WinDiskWriter somehow made my USB stick permanently read only & unusable, but this method worked. Thanks.

@nahsra58
Copy link

nahsra58 commented Jul 8, 2024

great tutorial, thank you!

@masonduug
Copy link

WinDiskWriter might be a malware and flagged by Apple.

093347

@bbmatt
Copy link

bbmatt commented Jul 10, 2024

Nice one, so used to creating bootable usb's from Linux images on mac, then when I tried win11 with Balena, it was apparent immediately it wasn't going to work.

A bit of google searching linked to all sorts of dodgy looking "help" sites with various tools, and of course, this wonderful gist.

Thank you kind person

@IamCoderman100
Copy link

IamCoderman100 commented Jul 12, 2024

WonderISO is a bootbale USB creator that can be used to create, edit, and burn ISO files. I have used this tool to create Windows installation disks on my Mac. The intuitive interface and full-featured features allow me to easily handle ISO files. However, the software can be a little slow when dealing with larger files, but it can process larger 4 GB ISO file successfully. I like it!

77

Can automatically split ISO files larger than 4GB,

887

@elliolir
Copy link

elliolir commented Jul 12, 2024

@masonduug it's not flagged by apple, that's the default warning you get when the app isn't signed with apple dev keys.

@TechUnRestricted thanks, worked perfect for me ✨✨✨

P.S. WonderISO is a garbage and a scam

@karthike72
Copy link

Actually worked for me just following above commands.. good job.. and beware of wonder iso and any other spammers there... they just cheat right infront of you

@maanisim
Copy link

$ wimlib-imagex split /Volumes/CCCOMA_X64FRE_EN-GB_DV9/sources/install.wim /Volumes/WINDOWS10/sources/install.swm 3800
[ERROR] Failed to open "/Volumes/WINDOWS10/sources/install.swm" for writing: No such file or directory
ERROR: Exiting with error code 47:
       Failed to open a file.
(base) 

$ ls /Volumes/WINDOWS10/sources
ls: /Volumes/WINDOWS10/sources: No such file or directory
(base)

The magical command for when using a split:

$ mkdir /Volumes/WINDOWS10/sources

@Lafondlly
Copy link

@masonduug it's not flagged by apple, that's the default warning you get when the app isn't signed with apple dev keys.

@TechUnRestricted thanks, worked perfect for me ✨✨✨

I find you are a scam, slandering your competitors everywhere, how rude! WonderISO is a good software, why do you want to discredit it?

@elliolir
Copy link

@masonduug it's not flagged by apple, that's the default warning you get when the app isn't signed with apple dev keys.
@TechUnRestricted thanks, worked perfect for me ✨✨✨

I find you are a scam, slandering your competitors everywhere, how rude! WonderISO is a good software, why do you want to discredit it?

Sorry you felt that way, a freshly-registered github member with no other online presence 😢

@j-j-j-jim
Copy link

@TechUnRestricted I wanted to drop a comment and thank you for this utility. I spent an entire day trying anything and everything on Mac and Linux trying to get a Win 10 PC going, and this was the only thing that worked.

@r2axz
Copy link

r2axz commented Jul 25, 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.

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