How to Restore and Wipe Your Mac Back to Factory Settings

By | December 27, 2021

In the past, to wipe your Mac and restore it to factory settings you had to boot into Recovery Mode, open Disk Utility, wipe and repartition your drive, then reinstall the entire operating system over the internet. Work often takes hours. On iOS, you can do this in just a few clicks, but isn’t it as easy as on a Mac?

Now restoring your Mac to its factory state is much easier, thanks to some new commands in your local macOS installer. See how you can wipe your machine with the touch of a button.

First: What To Do Before You Begin

The features we discussed were introduced in macOS High Sierra 10.13.4, so your machine must be running that version or higher to use –eraseinstall. Also, your hard drive must be in APFS format. If your hard drive is still using HFS+, you may be able to repartition your drive to APFS to take advantage of this.

Warning: When we say it will wipe your machine, we mean to erase everything on your computer. If you want to save data so that you can recover it after it is deleted, make a backup using Time Machine as we review here or method you prefer.

Second: Download the macOS Installer and Save

The first step in this process is to make yourself a copy of the latest macOS installer, ideally the same or higher version as what your machine is currently running.

Then, instead of running it, you want to save it somewhere so you can use it later.

Download From Mac App Store

If you’ve downloaded previous macOS installers from the App Store, they should still be available to you in your Purchases. Otherwise, only the latest version (which at the time of writing is macOS Mojave) is available for download. Like all macOS updates, it’s free.

Downloading it will automatically open System Preferences, and the installer will automatically save it in your /Applications folder. Feel free to put it anywhere; just remember where you put it.

Save to Another Disk for Easy Copying

Once you have a copy of the macOS installer downloaded to your machine, copy it to a flash drive or other external storage for later storage.

Third: Run the command –eraseinstall

This is where the magic happens. Hidden deep within your newly downloaded installer is a special command called startosinstall, with a new option called –eraseinstall.

To get there, select the installer, Ctrl + Click, and hit Show Package Contents. Then go to Contents > Resources > startosinstall. Open Terminal and drag startosinstall to the window. Then add –usage to the end of the command and hit Return to check for potential options.

Thanks For Visit

Important Options

The output for –usage lists all potential options for startosinstall. While there are a few options to consider, the important ones for our purposes are:

  • –agreetolicense: Automatically approve end-user licenses.
  • –eraseinstall: This deletes your current volume, and installs macOS on the new one. This is the heart of what we pursue.
  • –newvolumename: The name of the new volume you want to create using the command above. Usually, this is “Macintosh HD,” but you can make it whatever you want.

Save Commands Later Use

Here’s the command in question, all on one line for you. Just copy and paste it somewhere for later. Keep in mind that if your installer is somewhere other than your /Applications folder, you’ll need to change it in its path.

“/Applications/Install macOS” –eraseinstall –newvolumename “Macintosh HD” –agreetolicense

When you’re ready to pull the trigger, copy this command into Terminal, hit Return, and your part is done. startosinstall takes care of everything.

When your system restarts, you’ll have a new, happy Mac. You can restore from your Time Machine backup during the setup steps, or set it up as a new machine.

Why is this better?

Now that you know how to do this, why should you use it over the old method of reinstalling macOS?


Apart from taking most of the active steps of normal deletion and restore, once you’ve installed the installer, you can do this as many times as you want. Copying the installer from a USB is almost always faster than restoring macOS over the internet via Recovery mode.


This method takes many steps from a multi-step process. You don’t have to sit there, manually rebooting your machine, opening Disk Utility, repartitioning, and then going through the installer steps. The command takes all the active work out of it so you can do something other than keeping it.

For you Mac admins, this is a dream come true

This is useful for the layman trying to clean their Mac in as few steps as possible. However, this method shines the most in a corporate or lab environment, when you’re trying to wipe a dozen or more machines at once. Instead of lugging hard drives with your outdated images from machine to machine, you can drop them all in one go.

Package the installer with your favorite packaging application (like AutoPKG), deploy your device in a hidden place (like /var/tmp), and remotely send –eraseinstall command to remove as many machines as you need at the touch of a button. Either the installer falls first, or bundles it with your imaging workflow so you can easily remove and install.

Thanks For Visit