How to perform a clean install (or upgrade) of macOS Mojave via Terminal

Apple's newest OS contains an updated command for a clean install or in-place upgrade of macOS Mojave using just the installer file and one line of code.


The macOS High Sierra 10.13.4 update contains, among many fixes and tweaks, a newly added command titled startosinstall, located at /Applications/ Install/macOS\ High\ The command is to use when kicking off installations or upgrades from Terminal, and can be found by right-clicking the installer file and selecting Show Package Contents from the context menu, then navigating your way through the directories as detailed above.

While the change was documented on their website, it made little splash for many systems administrators due to the hidden nature of the command. Fast forward to macOS Mojave several months later, and the startosinstall command has seen a few modifications to aid admins in deploying macOS 10.14 the correct way--the new Apple-supported way--which allows for firmware updates to be delivered pre-update.

In the sections below, this article will cover the means to deploy macOS Mojave (or High Sierra if you're weary of making the jump), as both in-place upgrades and clean installations. Additionally, it will show the proper parameters and what they mean, and lastly, detail how to convert the existing filesystem to Apple's latest --APFS --all from a simple command, ready for mass deployment.

SEE: Five ways to make macOS more efficient on the go (free PDF) (TechRepublic)

Before we begin, note the minimum requirements below that are necessary to ensure that the deployment works without a hitch:

  • Apple computer with macOS High Sierra installed (10.13.4 or newer)
  • Administrative credentials
  • Install macOS High (or newer)
  • Internet access (Required to download installer from Mac App Store)
  • 1st/3rd-party MDM or Deployment software (Optional; But highly recommended for mass deployments)

startosinstall command & syntax

Command: startosinstall

Requires root access: Yes


- -usage: Displays all parameters available for the command.

- -agreetolicense: Agrees to the license agreement during deployment (Required for automated deployments).

- -rebootdelay: Delays reboot after preparation is complete, in seconds.

- -eraseinstall: Erases the existing APFS volume prior to installing macOS.

- -newvolumename: Renames the volume erased when used in conjunction with --eraseinstall.

- -converttoapfs: Coverts the existing filesystem to APFS. (Deprecated in macOS Mojave, however still exists in High Sierra).

- -nointeraction: Undocumented parameter that automates the deployment process without prompts.

Clean installation of macOS Mojave

1. Copy the Install macOS installer file to the target computers /Applications folder.

2. Enter or deploy the following command to the target system(s).

sudo /Applications/Install\macOS\ --agreetolicense --eraseinstall --newvolumename "Macintosh HD" --nointeraction

In-place upgrade installation of macOS Mojave

1. Copy the Install macOS installer file to the target computers /Applications folder.

2. Enter or deploy the following command to the target system(s).

sudo /Applications/Install\macOS\ --agreetolicense --nointeraction

There are two things to note prior to choosing whether to perform an upgrade or clean install:

First, as stated above the parameter to convert to the APFS filesystem is deprecated as of macOS Mojave (though still optional in High Sierra, hence why it can be toggled with via YES or NO). By default, macOS will convert SSD drives that will house the home folder. HDD's and Fusion Drives will not be modified.

SEE: Mac Mini 2018: Cheat sheet (TechRepublic)

Second, due to how Apple is distributing firmware updates, devices will receive pending firmware updates during deployments such as these, moving forward. Since block-copy methods typically in use in larger environments reconstruct the installer files, firmware updates will not be performed when using those methods, and more often than not, installations will fail because of it.

Also see

By Jesus Vigo

Jesus Vigo is a Network Administrator by day and owner of Mac|Jesus, LLC, specializing in Mac and Windows integration and providing solutions to small- and medium-size businesses. He brings 19 years of experience and multiple certifications from seve...