Methods to perform an erase and install on macOS

Darren WallaceApple, macOS, Maintenance, Training

Introduction

There are many reasons you may wish to wipe and reinstall macOS on a device (sometimes known as a ‘nuke and pave’). Perhaps you are wiping the device to switch it between users or roles. Perhaps you need to move it to a totally different management solution, or perhaps you have no option but to perform a full wipe to resolve an issue. What you may not realise is there are as many ways to perform an erase and install as there are reasons to do it. In this post, I will explore a few of the methods available.

GUI/Manual method

The first, and most commonplace, is the GUI or manual method which involves the following steps:

  1. Booting to the recovery partition by holding down Command+R at boot up (more options are available and Apple has detailed these here – Apple | How to reinstall macOS from macOS Recovery).
  2. Launch Disk Utility, select the correct volume and erase this (Apple also has a great knowledge base on this – Apple | How to erase a disk for Mac).
  3. Proceed through the OS installation as normal.

This process will then download the version of the OS install media required and, depending on which boot up options you selected above, will run through the installation. 

You can speed up the download of the OS install media if you are repeating this process with the use of an Apple Caching Server, something I would recommend for any Apple Admins with a reasonable macOS and/or iOS deployment.

Another option is to create a bootable USB installer drive to save on the download. Apple has another useful piece on this here – Apple | How to create a bootable installer for macOS. Despite the many advantages of this method, there are a few disadvantages:

  • You will need to create new/updated USB drives when Apple releases new OS versions.
  • You will need to ensure the Mac can boot and run the OS you have on your bootable drive – something the recovery method above will do automatically.
  • The Mac/s may still need to download some items from Apple directly, including BridgeOS updates.

One vital element to remember when using this method is to wipe the drive before going through the installation. This is easy to miss and something I have done myself when in a hurry.

Command line method

As you can see, the GUI/manual method requires a lot of work and presents a few opportunities for mistakes or missteps. With macOS High Sierra, Apple added a command line option to install macOS: startosinstall . Apple mentions this here – Apple | How to install macOS at your organisation. However, this only gets us part of the way through a wipe and reinstall.

With macOS 10.13.4 or newer installer apps, and only on devices running on APFS (nowadays this should be anything running macOS 10.14 or newer) Apple provides a new flag: –eraseinstall. This allows you to perform an in-place erase and install of macOS.

If you are looking for more details on the usage, read Graham Pugh’s brilliant post on the subject here – Graham Pugh | Erase All Contents And Settings – erase and reinstall macOS in situ.

Still too much work? Graham also has a command line tool called ‘erase-install’ that can alleviate some of the faff. You can find the project here – grahampugh | erase-install.

Management tool method

What about using your Management tool to automate the deployment and running of the erase and install in-place workflow? I have listed two external posts you may find useful:

EraseInstall application method

What about if you want to deploy a simple method to devices for end users to carry this out themselves? Armin Briegel (of Scripting OS X and Pro Warehouse fame) has you covered with his EraseInstall Application.

He lays this out in his blog Scripting OS X | EraseInstall Application. This solution provides a simple GUI application to allow users to perform the erase and install themselves.