softwareupdate fetch latest installing old OS

New Contributor III

Hi all,

I have set up a script to take advantage of the new softwareupdate --fetch-full-installer command. If you're not aware this will download the latest macOS installer into the applications folder. It will then run a startosinstaller command to wipe and reinstall the OS. I have linked this in self service to make a 1 click reimage. I have tested this on a DEP enabled machine and it works perfectly!

I want to do the same for my non-DEP machines so I have added the --installpackage to the startosintaller line that should install a quickadd and DEP-Notify then get picked up on completed enrollment trigger to start DEP Notify.

The issue im having is that the software update command is downloading macOS High Sierra instead of catalina. The laptop currently has catalina installed so im not sure why its downloading an older OS.

Has anyone experiencd this issue? I have also specified version 10.15 but it just fails. Running the command in terminal has the same result.


macOS Erase and Reinstall Script for Non-DEP computers

macOSVersion=$(defaults read /Applications/Install macOS CFBundleShortVersionString)


if [[ -d /Applications/Install macOS ]] && [[ "$macOSVersion" == "$CurrentVersion" ]]; then

echo "macOS is cached and ready to install" > /Library/logs/Erase and Install.log


echo "Downloading latest macOS..." > /Library/logs/Erase and Install.log softwareupdate --fetch-full-installer


echo "Wiping and installing"

/Applications/Install macOS --eraseinstall --agreetolicense --installpackage "" --forcequitapps --newvolumename 'Macintosh HD'

Thanks James