Here is how to create a USB install disk for macOS. These are useful for upgrades and reformatting machines.
1) Download the operating system from the Mac App Store. When the download completes, close the installation window that pops up. Check your Applications folder for the download (seen screenshot below).
2) Inset an 8 GB or larger USB drive into your computer. Format it using Disk Utility, and these parameters (see screenshot below).
3) Open Terminal, run the command for the operating system version you have chosen:
macOS 10.14 Mojave:
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/USB1
macOS 10.13 High Sierra:
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB1
macOS 10.12 Sierra:
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB1 --applicationpath /Applications/Install\ macOS\ Sierra.app
4) If you are using a decent USB 3.0 flash drive, the process should take approximately 5 minutes. When it completes, you should see a message that says “Done”.