DEV Community

Paul Stevens
Paul Stevens

Posted on

Bootable Win10 USB from macOS

I recently needed to build a new bootable USB to get Windows 10 back onto my desktop PC. Having not done this in quite some time, I didn't realise just how difficult this was going to be.

Starting from Microsoft's website, I download the latest ISO for Windows 10, created a bootable USB, mounted the USO, copied the contents and then tried to install my OS. It didn't work, as a PC will not boot an exFAT partition. I then wasted £32 on uuBYTEISOEditor, which also didn't work. UNetBootIn didn't work either.

The issue with a lot of these tools is that while the USB will boot, the moment you click the Install Now option, you'll run into "media not found" errors, which no amount of USB port switching will fix.

What I ended up doing to get a bootable USB was the following:

Format your USB drive from the command line:

$ diskutil eraseDisk MS-DOS "WINDOWS10" MBR disk2

This pops the FAT32 filesystem on your USB, which is what Windows wants for a bootable USB. Ironically, this also means that a very particular file will not fit on that particular filesystem. That file is located at sources/install.wim and needs to be fixed before we can use it, as its over 4GB in size and cannot be copied to a FAT32 file system.

Mount your ISO file to access the contents (it's just an archive):

$ hdiutil mount ~/Downloads/Win10_1909_English_x64.iso

This will mount the ISO image as:

/Volumes/CCCOMA_X64FRE_EN-US_DV9

Now copy everything except install.wim to your USB:

$rsync -avh --progress --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/ /Volumes/WINDOWS10

Once that's done, install the tool you'll need to deal with the oversize file:

$ brew install wimlib

Instead of splitting install.wim, we're going to compress it, which takes a little longer but was the solution I went for first and found to work:

$ cd ~/Downloads
$ cp /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim .
$ chmod u+x install.wim
$ wimlib-imagex optimize install.wim --solid

On my 2018 15" MacBook Pro, this took about 18 minutes to complete.

The file compressed some more, you can copy it off to your USB:

$ cp install.vim /Volumes/WINDOWS10/sources/

Unmount the USB:

$ diskutil unmount /dev/disk2

Now slot the USB into your Windows machine and install Windows. I'm just left wondering why this had to be so difficult.

Top comments (5)

Collapse
 
polyzargone profile image
Polyzargone

Hello,

Thanks for this but I think there's 2 mistakes:

Instead of:

chmod u+x install.wim

I think it should be:

chmod u+w install.wim

Otherwise, we can't modify the file. We don't need to execute it.

Also, I think the last command:

cp install.vim /Volumes/WINDOWS10/sources/

Should be:

cp install.wim /Volumes/WINDOWS10/sources/

.vim vs .wim

Collapse
 
kendeld00 profile image
Kendeld00

There are a lot of issues with the latest Windows 10 ISO (2004). Wasted at least three hours with command line and no work. My first suggestion is not to format USB to exFAT, which can hold large files but will not be recognized as a bootable device. Also GPT has the same issue.

My final attempt is to download an old version of Windows 10 ISO and burned it with UUByte ISO Editor. It worked this time. After that, upgrade Windows 10 to latest stable version.

Hope this helps!

Collapse
 
bagheeranl profile image
BagheeraNL

Another method:
Install a windows version on vm and use DISM to alter the install.wim to delete "the not needed windows version" from the file. --> google: DISM shrink install.wim

Collapse
 
pvsukale profile image
Prithviraj sukale

Thanks this helped me a lot. I spent like 2 days on this.

Collapse
 
ericago25 profile image
Ericago25

Hi, is this how I run the command ti compress install.wim? It says command not found.