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.

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

jamfhelper-erase

The script 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.

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.

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, Franch 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.