How to create a bootable Windows 10 usb on MacOS

I was recently putting together a low cost Windows 10 Machine for my dad (post on that to follow) and realized how non-trivial of a task it is to create a bootable windows 10 usb drive using a mac. (If you have a windows machine availiable, simply use the windows 10 installation media creation tool located here) After trying several methods I have put together a quick how-to guide on creating windows 10 installation media (usb) using the latest version of Mac OSX at the moment 10.15. This guide was adapted from this blog

Format USB Drive

Open your terminal and identify your USB drive using diskutil list. Once identified, format the drive diskutil eraseDisk MS-DOS "WN10" MBR diskNumberHere where diskNumberHere represents your USB drive. 

Copy Files

After downloading the latest Windows 10 ISO open the ISO within finder and identify the volume name using ls /Volumes

The install.wim file located within /sources/install.wim of all recent Windows 10 ISO files is now larger than 4gb therefore a simple copy function to a FAT32 formatted USB drive will not work. 

First we will copy over all files except install.wim using:

rsync -avh --progress --exclude=sources/install.wim /Volumes/WN10ISO/ /Volumes/WN10

Next we will use the wimlib tool to segment and copy the files to <3800mb fragments. Wimlib is easily installed using HomeBrew (brew install wimlib) to copy over install.wim. After installing wimlib run the following command:

wimlib-imagex split /Volumes/WN10ISO/sources/install.wim /Volumes/WN10/sources/install.swm 3800

Once completed, eject your USB Drive and attempt to boot from USB on your new Windows 10 Machine.