This is how it was formerly done – Your first boot your system into Recovery Mode and then to Disk Utility, after which you erase the drive, then followed by re-partition.
And finally the OS re-installation. The previous versions of macOS have this endless process of restoring the system to its factory settings.
Thanks to Apple who has taken the hint. There is an update which was rolled out in High Sierra that cuts down the process and the time involved in the process.
It makes restoring a quick and straightforward task. This article will be explaining the steps which are needed after the update.
Note: before you begin the process you have to have some things in mind. Your Mac must be running MacOS High Sierra 10.13.4 or higher.
The feature ‘–eraseinstall’ was introduced in High Sierra and also ensure that your hard drive is APFS formatted. Re-partition might not be possible otherwise.
And lastly, this process will erase all your data that are stored on the Mac. Therefore you are advised to keep your data and then restore it after you have deleted everything, use Time Machine. You can choose any alternative method if you have any on your tips.
Download MacOS installer
It is the best way to go about this is to keep a copy of the latest macOS installer and then save it elsewhere for later use. You can also download it through the App Store. It will be listed under Purchases. If not, the latest OS update will be present.
Once downloaded, System Preferences will open automatically, and it will be saved by default in ‘/Applications’. You can also move it elsewhere if you wish. But we recommend copying it to a USB drive or an external HDD as well for safe keeping.
Running the command
Within the downloaded installer, you will find a command called ‘startsosinstall’ under which you will find ‘eraseinstall.’ to view this, you will have to open the installer through the keyboard shortcut Ctrl + Click, and not the usual click.
Then go to Show Package Contents > Resources. You will find ‘startsosinstall’, open Terminal and drag this command onto the window afterwards type ‘–usage’ at the end of the command and finally press Return.
Once that is done, you will be able to view a list of several options. Some of which are ‘–agreetolicense’, ‘–eraseinstall’, ‘–newvolumename.’ each has its unique function, either to agree to the end-user license, erases the volume and make changes to the name of the new volume.
Save this Command elsewhere
/Applications/Install/ macOS Mojave.app/Contents/Resources/startosinstall --eraseinstall --newvolumename MacintoshHD --agreetolicense
This is the line of command that will erase your Mac and restore it to its factory settings. When you have backed up everything and all data has been taken care of, paste the command above into the Terminal and then click on return.
Remember that if you have saved the installer anywhere else, that path needs to be used instead of ‘/Applications.’