Last active
December 25, 2024 23:58
-
-
Save emilorol/f4058422a35bbfb2ec577d5f40bee775 to your computer and use it in GitHub Desktop.
Windows 10 ISO to bootable USB in MacOS (balenaEtcher, Rufus and Unetbooting alternative)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inspiration from here as I was looking for an alternative to balenaEtcher, Rufus and Unetbooting | |
# | |
# https://forums.balena.io/t/missing-partition-table-issue/175129/10 | |
# | |
# there is a single file sources/install.wim that is larger than 4GB | |
# and the FAT32 file system has an issue with that, so we will use this | |
# to split it into chunks that are less than 4 GB each | |
brew install wimlib | |
# check the file name of the ISO downloaded from microsoft.com | |
image_file=Win10_21H1_English_x64.iso | |
# special kind of mount. Keep in mind that it will not be displayed | |
# as a volume in the finder window or finder sidebar | |
hdiutil mount ${image_file} | |
# find windows ISO mounted volume name | |
ls -lha /Volumes | |
# update variable with name | |
mounted_iso_name=CCCOMA_X64FRE_EN-US_DV9 | |
# assuming USB is on /dev/disk3 | |
usb_disk=$(diskutil list | grep external | head -n 1 | awk '{print $1}') | |
# let's format the USB drive and label it WINDOWS10 | |
diskutil eraseDisk MS-DOS "WINDOWS10" MBR ${usb_disk} | |
# copy everything, but the larger then 4GB file sources/install.wim | |
rsync -avh --progress --exclude=sources/install.wim /Volumes/${mounted_iso_name}/ /Volumes/WINDOWS10 | |
# let's split it now and copy it over the USB next | |
wimlib-imagex split /Volumes/${mounted_iso_name}/sources/install.wim /Volumes/WINDOWS10/sources/install.swm 3800 | |
# Eject the Windows10 volume | |
hdiutil eject /Volumes/WINDOWS10 | |
# Eject the ISO mounted volume | |
hdiutil eject /Volumes/${mounted_iso_name} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment