Skip to main content

Based on a JAMF webinar I want to create a self serv item that would format the drive on a Mac and install Catalina.

I have created a policy that deploys Install macOS Catalina.app to /Applications
and a second policy that executes the command '/Applications/Install macOS Catalina.app/Contents/Resources/startosinstall' --eraseinstall --agreetolicense --forcequitapps --newvolumename 'Macintosh HD' --nointeraction &

In theory, this should quite all open apps, restart the computer, wipe the drive and install macOS Catalina.

All it does is create a new partition and dump the installer files in there. That's it! The Catalina package runs fine when I install it manually.
What am I doing wrong here?

@chase.garcia Thanks! the updated script worked perfectly


Has anyone had issues like this with the https://github.com/kc9wwh/macOSUpgrade/blob/master/macOSUpgrade.sh script?

Script result: installerVersion 10.15.7
installerVersion_Full_Integer 101507
installerVersion_Major_Integer 1015
Killing caffeinate processes.
Killing startosinstall processes.
No matching processes were found
Killing osinstallersetupd processes.
No matching processes were found
Power Check: OK - AC Power Detected
Disk Check: OK - 144709979400 Bytes Free Space Detected
Installer check: Target version is ok (10.15.7).
Installer check: DMG file check: Skipped.
Installer check: PASSED
Launching jamfHelper as Utility Window.
Running a command as '"/Applications/Install macOS Catalina.app//Contents/Resources/startosinstall" --agreetolicense --nointeraction --pidtosignal 7897 --forcequitapps >> /var/log/startosinstall.log 2>&1 &’..

I like this script, but it seems to fail for strange reasons after a certain step. Also, these other scripts seem great, but what if you simply want to upgrade a user to Catalina instead of Wiping/Erasing the Device?

I’ve also tried editing this script:

!/bin/sh

prevent computer from sleeping for the next 3 hours. Prevents computer from falling asleep when on battery;

obtain variable on whether the Self Service app is running;

caffeinate -t 10800 & selfservice=$(pgrep -x "Self Service");

determine whether self service app is running and whether the macOS Catalina installer is already there;

if the installer is not already there and self service app is running then begin download;

if [ ! -z "$selfservice" ] && [ ! -d "/Applications/Install macOS Catalina.app" ];
then echo "Self Service is running but no Installer exists. Proceed with Download and Install";

if it doesn't get it on the first try then try again a few times as sometimes it doesn't work on the first try;

counter=$((counter + 1));
until [[ -d "/Applications/Install macOS Catalina.app" ]] || [[ $counter == 4 ]];

to avoid download issues remove the softwareupdate plist file;

do rm /Library/Preferences/com.apple.SoftwareUpdate.plist;

kill the prefs daemon process to reload preferences;

killall cfprefsd;

download installer;

/usr/sbin/softwareupdate --fetch-full-installer;
counter=$((counter + 1));
done; echo $counter;
echo "Installer was successfully downloaded or try counter reached 4...";

update and reinstall machine;

'/Applications/Install macOS Catalina.app/Contents/Resources/startosinstall' --agreetolicense --forcequitapps;

if the installer is already there and self servie app is running then just start installing;

elif [ ! -z "$selfservice" ] && [ -d "/Applications/Install macOS Catalina.app" ];
then echo "Self Service is running and Installer already exists. Proceed with Install";
'/Applications/Install macOS Catalina.app/Contents/Resources/startosinstall' --agreetolicense --forcequitapps;

as a safety feature to not blow away your company due to a bad scope or wrong trigger in Jamf the reinstall will not happen unless the self service app is running;

else echo "Self Service is stopped. Will not proceed with Install.";
fi

But, this script also fails. Any assistance you all might be able to provide would be greatly appreciated.