Windows Installer USB on macOS

The Windows installer is pretty finnicky. I have found that dd or restoring from Disk Utility usually doesn’t work. The most reliable way to create a Windows installer is through the Windows Media Creation Tool or through Rufus. However, neither of these tools are available on macOS. This method tries to simulate how Rufus works. However, it is not perfect, and requires DISM installation. I believe this is because the Windows installer is not designed to use exFAT, and macOS doesn’t support writing to NTFS. This could perhaps work better on linux with an NTFS partition, but I have not tried it yet.

Creating the USB

  1. Have your USB plugged in, and download the Windows ISO of your choice in your Downloads folder (in this case, it will be Win11_22H2_English_x64v1.iso).

  2. Open Disk Utility:

    Disk Utility in Launcher

  3. Under “View,” make sure “Show All Devices” is clicked

    Show All Devices Selected

  4. Find and select your USB drive in the sidebar. Make sure it is the device (the topmost one), not the volume.

    USB Device Selected

  5. Click “Erase” near the top-left, and select the following options for Format and Scheme. You can name it whatever you want. Make sure you have selected the right drive and the right options. This will wipe all data on the USB drive. Wait till the erasing process is complete.

    Erase menu with exFAT and GPT selected

  6. Download uefi_ntfs.img from here. You can click the “Download” button to download it. Once downloaded, control-click the file in Finder and then hold option/alt. The Copy option will turn into “Copy uefi_ntfs.img as Pathname.” Click that, then the path will be copied.

    GitHub download page

  7. Open Terminal, and run the command diskutil list. You can run a command by typing/pasting it then pressing Enter. It should show something like this:

    Output of diskutil list

  8. Identify your disk based on the size and it saying “external, physical”. In my case, it is disk4. Confirm that it has two partitions, of type “EFI” and “Microsoft Basic Data.”

    Output of diskutil list, cropped to show USB drive

  9. Run the command sudo dd if=<pathname> of=/dev/r<disk identifier>s1 status=progress, replacing <pathname> with the path you copied in step 5 and <disk identifier> with the identifier you found in step 7. The r in the device puts it in raw mode, which makes it faster. You will need to type in your password (the letters won’t show up while you are typing them).

    The DD command being used with UEFI:NTFS

  10. In Finder, double-click the Windows ISO file to mount it. You then should be able to navigate to it in Locations.

    Finder with ISO mounted and open

  11. Select everything, then drag it to your volume (in this case mine is Untitled).

    Copying Windows files

  12. Eject the drive.

Installing

You may find this guide from Kari Finn easier for this section if you are uncomfortable with using diskpart.

  1. Physically remove all disks other than the USB drive and your boot drive from the computer to help with identification. You probably will also need to turn off Secure Boot, though this can be turned back on after installation. Then, boot from the drive and start installing it normally. When installing, you will probably get the following error:

    Windows installation error

  2. Press Shift + F10 to open the command prompt in the windows installer, then run diskpart.

    Diskpart open in command prompt

  3. The partially completed automatic installation we just did created our drives for us. Run lis vol to confirm our drive letters. The exFAT partition (in this case C), will be our USB drive, the large NTFS partition (in this case E) will be our root partition, and our EFI system partition will be D. This is pretty confusing, since the root partition is normally C, but in this case it’s E.

    Output of lis vol in diskpart

  4. Leave diskpart, then run cd /d <drive letter>:\sources where <drive letter> is your USB drive/exFAT partition.

    Running cd /d C:\sources

  5. Run dism /get-imageinfo /imagefile:install.wim to view the available editions. If it shows an error about the image file not being found, you are on the wrong drive letter. In this case, I want to install Windows 11 Pro, which is index 6.

    Viewing editions/indexes

  6. Run dism /apply-image /imagefile:install.wim /index:6 /applydir:E:\, substituting the index for your desired index and the applydir for the drive letter of your main partition.

    Applying dism image

  7. After it is complete, run bcdboot E:\Windows /s D:, again substituting E: with your main drive letter and D: with your ESP drive letter:

    Running bcdboot

  8. Reboot using wpeutil reboot. You can also turn secure boot back on at this point.

Previous Post

Rocky Linux with Cloud-Init