Py2/py3 script that can download macOS components direct from Apple
NOTE: As of macOS 11 (Big Sur), Apple has changed the way they distribute macOS, and internet recovery USBs can no longer be built via MakeInstall on Windows. macOS versions through Catalina will still work though.
NOTE 2: As of macOS 11 (Big Sur), Apple distributes the OS via an InstallAssistant.pkg file.
BuildmacOSInstallApp.command is not needed to create the install application when in macOS in this case - and you can simply run
InstallAssistant.pkg, which will place the install app in your /Applications folder on macOS.