Skip to content
Graham Pugh edited this page Oct 17, 2022 · 15 revisions

erase-install.sh

by Graham Pugh

WARNING. This is a self-destruct script. Do not try it out on your own device!

erase-install.sh is a script to reinstall macOS directly from the system volume using startosinstall, which is built into macOS installer applications since version 10.12.4. The eraseinstall option was added with macOS 10.13.4.

The script can be used to download macOS full installers, and to reinstall, upgrade or erase macOS.

Note: Version 27.x is the last feature release of this script that works on macOS Catalina and below. Version 28.0+ of this script uses Bart Reardon's swiftDialog for notifications and messages, which requires macOS Big Sur 11.0 or newer.

depnotify-erase

Full screen message using DEPNotify

jamfhelper-erase

Full screen message using jamfHelper

The script (up to version 27.x) is designed to interact with installinstallmacos.py, a script developed by Greg Neagle, in order to download a macOS Installer application directly from Apple to the client. However, to allow the two scripts to operate better together, a forked version of installinstallmacos.py is used (see grahampugh/macadmin-scripts). It is alternatively possible to use the softwareupdate --fetch-full-installer command that is built in to macOS since 10.15, though the default method is to date more reliable and more flexible.

Version 28.0+ of this script uses Nindi Gill's mist-cli instead of installinstallmacos.py.

Originally designed to work with Macs that are enrolled into Jamf Pro, it now has additional options for use with other management systems or no management systems at all. It can work with the DEPNotify application to provide notifications to the user as downloads and installations progress. Version 28.0+ no longer has jamfHelper as an option, so is suitable for any management solution.

The script has many options to suit a large variety of workflows, management tools and user experiences. Options are supplied as command line arguments. For example, if you wish to use the script to download the latest macOS Big Sur installer and use it to upgrade the system in a single step, you would use the following command:

sudo /path/to/erase-install.sh --reinstall --os=11

The dialog messages have been localised in English, German, French and Dutch. Please submit Pull Requests if you wish to supply other languages.

Please use the Wiki's menu to learn about how to install and deploy the script, as well as all the options for interacting with it.