UPDATE: This article has been updated to include the commands for macOS High Sierra and Mojave.
Over the years, upgrading to the latest version of macOS has become a simple process. However, occasionally it still makes sense to complete a fresh installation (wiping the existing operating system).
The quickest and most reliable way to complete this process is via removable storage (e.g. Bootable USB). I would recommend a USB3 Drive, with at least 16GB of storage. The removable storage will be erased as part of the process, therefore it is important to back up any existing data.
Prior to starting the process, download the desired version of macOS directly from the Apple App Store. Never download an image from a non-official source, as the installation could have been maliciously modified. The links for macOS Sierra, High Sierra and Mojave can be found below.
Insert the removable storage and run one of the following terminal commands, depending on your selected version of macOS. The only configuration required is to enter the name of the removable storage, which can be found in Disk Utility. The process will require you to enter your password and could take up to 30mins (depending on the speed of the removable storage).
macOS 10.12 Sierra
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/<NAME> --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction &&say Done
macOS 10.13 High Sierra
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/<NAME> --applicationpath /Applications/Install\ macOS\ High\ Sierra.app --nointeraction &&say Done
macOS 10.14 Mojave
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/<NAME> --applicationpath /Applications/Install\ macOS\ Mojave.app --nointeraction &&say Done
Simply hold “Command+R” on boot to enter macOS Recovery mode. Then select “Utilities > Startup Security” from the menu bar. Finally, check “No Security” and “Allow booting from external media”. These setting can be reversed post installation.
Once complete (or if you don’t have a Mac with the T2 chip), simply restart the Mac, hold the “Option” key and select the newly created removable storage.