Long ago, to wipe your Mac and restore it to factory settings you had to boot into Recovery Mode, open Disk Utility, erase and repartition your drive, then reinstall the whole operating system over the internet. This often took hours. On iOS, you can do this in a few taps, so shouldn’t it be as easy on a Mac?
Thanks to an update introduced in High Sierra, it’s getting there. Now restoring your Mac to factory condition is a whole lot easier, thanks to some new commands in your local macOS installer. See how you can make wiping your machine almost as simple as a touch of a button.
Step 1: What to Do Before You Start
The feature we’re covering was introduced in macOS High Sierra 10.13.4, so your machine must be running that version or higher to use --eraseinstall
. Additionally, your hard drive must be APFS-formatted. If your hard drive is still on HFS+, you might be able to re-partition your drive to APFS to take advantage of this.
Warning: When we say this will erase your machine, we mean it will irrecoverably obliterate everything on your computer. If you want to save your data so you can restore it after you wipe it, back up using Time Machine or your preferred method.
Step 2: Download a macOS Installer and Save It
The first step in this process is to get yourself a copy of the latest macOS installer, ideally the same version or higher than what your machine is running now. Then, instead of running it, you’ll want to save it somewhere so you can use it later.
Download From the Mac App Store
If you have 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 save itself by default in your /Applications folder. Feel free to place it anywhere; just remember where you put it.
Save It 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 to save for the next time around.
Step 3: Run the –eraseinstall command
This is where the magic happens. Hidden deep inside your newly downloaded installer is a special command called startosinstall
, with a brand-new option called --eraseinstall
.
To get to it, select the installer, Ctrl + Click it, and hit Show Package Contents. Then go to Contents > Resources > startosinstall. Open Terminal and drag startosinstall into the window. Then add --usage
to the end of the command and hit Return to check out the potential options.
Important Options
The output for --usage
lists all the potential options for startosinstall. While there are a few options worth taking a look at, the important ones for our purposes are:
--agreetolicense
: Agrees to the end-user license automatically.--eraseinstall
: This erases your current volumes, and installs macOS on a new one. This is the heart of what we’re after.--newvolumename
: The name of the new volume you want to create using the above command. Usually, this is “Macintosh HD,” but you can make it whatever you want.
Save This Command for Later
Here’s the pertinent command all on one line for you. Just copy and paste it somewhere for later. Keep in mind that if your installer is in a place other than your /Applications folder, you will need to change that in the path.
"/Applications/Install macOS Mojave.app/Contents/Resources/startosinstall" --eraseinstall --newvolumename "Macintosh HD" --agreetolicense
That’s it. When you’re ready to pull the trigger, copy this command into Terminal, hit Return, and your part is over. startosinstall takes care of everything else.
When your system boots up again, you’ll have a fresh, 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?
It’s Faster
Aside from taking out most of the active steps from a normal erase and restore, once you have the installer downloaded, 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.
It’s Simpler
This method takes a lot of steps out of a multi-step process. You don’t have to sit there, rebooting your machine manually, 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 else instead of babysitting it.
For Mac Admins, It’s a Dream Come True
This is useful for a layman trying to wipe their Mac clean in as few steps as possible. However, this method really shines in a corporate or lab environment, when you’re trying to wipe a dozen machines or more at once. Instead of bringing a hard drive with your deprecated image from machine to machine, you can knock them all out in one go.
Package up the installer with your favorite packaging app (like AutoPKG), deploy it your machines somewhere hidden (like /var/tmp), and remotely send the --eraseinstall
command to wipe as many machines as you need with the touch of a button. Do the installer drop in advance, or bundle it up with your imaging workflow so that you can do erase and installs at the drop of a hat.
Repair macOS Instead of Restoring It
Having software problems but don’t have a backup solution for all your personal data? No problem.
You can fix a lot of software issues simply by reinstalling macOS in Recovery Mode. The best part of this method is that you can do it without losing data. Just make sure to skip the step that involves using Disk Utility to wipe the partition, and go straight to Reinstall macOS.
Read the full article: How to Erase and Restore a Mac to Return to Factory Settings
from MakeUseOf https://ift.tt/2UtcGRf
via IFTTT
No comments:
Post a Comment