Hi everyone. I am completely new to JAMF. I've gone through several training videos. None of which really give good insight into upgrading a group of computers to Mojave. I have been able to set up Mojave installer to be pushed to the computers as we have an apple school account. But for the life of me cannot figure out how to get the installer to run without prompts and keep data in tact. Any and all help is totally appreciated.
To upgrade you want to run the following command so no prompts appear
#!/bin/bash
/PathTo/Install macOS Mojave.app/Contents/Resources/startosinstall --applicationpath /PathTo/Install macOS Mojave.app --agreetolicense --nointeraction
https://support.apple.com/en-us/HT208488
startosinstall commands
--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: Converts 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.
@Hugonaut Where would this script go?
2 Parts here,
1st Part. Create a script in your JPS Dashboard
Script contains
#!/bin/bash
/PathTo/Install macOS Mojave.app/Contents/Resources/startosinstall --applicationpath /PathTo/Install macOS Mojave.app --agreetolicense --nointeraction
2nd Part. Create a policy that contains the script, and deploy to computers however you see fit, via self service or silently. This will trigger (If the Moajve installer is in that location) the upgrade
@Hugonaut Thanks for the help and quick response. Will give it a go! Thanks again!
@achristoforatos You're welcome! Glad to help!
Will this work form non-admin users?
@ozab it will since its being ran by your JSS management account
@Hugonaut Why would you do it via a script instead of the Execute Command located in Files and Processes module?
@Ricky personal preference, I've always run everything as raw scripts, now done from the jps scripts repo, pre jamf habits =)
Good morning! Hope you had a great Christmas. I set up the policy/script. However I get error code when running. It states "Error running script: return code was 1". Any advice?
@achristoforatos can you take a screenshot of the policy history log expanded, also what operating system version number is the computer on that you're upgrading?
The computer is currently on Mojave and I was trying to test that it would run. Could that be the issue?
drop the sudo and try it, if it's on mojave that is an issue, are you trying to totally wipe the device and reinstall oem mojave? if so the following command works on machines that are currently mojave but wipes the machine to oem
To Erase & Overwrite a Mojave Machine back to OEM do the following (this is the exact script I use right now for redistributing T2 Mojave Machines)
#!/bin/bash
# Start Erase and Reinstall process Mojave
/PathTo/Install macOS Mojave.app/Contents/Resources/startosinstall --agreetolicense --eraseinstall --newvolumename "Macintosh HD" --nointeraction &
exit 0
to Upgrade the following should work
#!/bin/bash
/PathTo/Install macOS Mojave.app/Contents/Resources/startosinstall --applicationpath /PathTo/Install macOS Mojave.app --agreetolicense --nointeraction
Not trying to wipe device. We just want the installer to run so it can upgrade machines which do not have Mojave. or which may need a reinstall of Mojave. or both. But if even to get it just install on non Mojave machines that would be fine.
then you want this script
#!/bin/bash
/PathTo/Install macOS Mojave.app/Contents/Resources/startosinstall --applicationpath /PathTo/Install macOS Mojave.app --agreetolicense --nointeraction
Thanks for that new script. IS there a way to force a script to run on scoped machines? Tried the blank push since I have it to run once per computer at check in. but wondering if there is a way to force it.
you're welcome hope it's working for you now!
should work by force, if an application is running it might stop it from restarting into the installation, you can always run a script at the very end to force a restart, "shutdown -r now" and then it should definitely work
Very helpful, thanks for posting this!
Hello all, while this does work for me, I am finding the --applicationpath option is deprecated in my testing. I haven't removed it to verify it continues to work. Again, this is only happening with the macOS Mojave installer. macOS High Sierra still has this option.
I am using this command both as a one liner in files and processes and also from a script but each time I get a pop-up on the target device wanting admin credentials for osinstallersetupd, if I cancel the log I get is 'Error: Could not create a new APFS volume. Please try again.'
My users are not admin but I assumed the script or command would be run as root as it is run by the Jamf binary.
My command is Applications/Install macOS Mojave.app/Contents/Resources/startosinstall --agreetolicense --eraseinstall --newvolumename "Macintosh HD" --nointeraction &
I also get the same thing if I remove the --newvolumename "Macintosh HD" section.
Any ideas?
@awginger I ran into the same issue with Mojave and non-admin users. Are your users running your script from Self Service? If so, take a look at https://github.com/kc9wwh/macOSUpgrade. That was made by a Jamf employee and has worked great. It does require a little modification if your users are non-admin though.
I found this slick modification elsewhere on JamfNation, having trouble finding who posted it so I can't give credit. At line 493 of the current version posted (or above the Begin Upgrade comment in the APPLICATION section), add this:
## Add users to upgradeadmin group which is part of admin group to ensure successful install
## Elevation to avoid osinstallersetupd issue.
## Remove upgradeadmin group during finishOSInstall.sh
/usr/sbin/dseditgroup -q -o create -n /Local/Default -r "Admin access for macOS upgrade" upgradeadmin
/usr/sbin/dseditgroup -q -o edit -n /Local/Default -a upgradeadmin -t group admin
/usr/sbin/dseditgroup -o edit -a "${currentUser}" -t user upgradeadmin
/usr/bin/dsmemberutil flushcache
And then at line 368 (above the Update Device Inventory in the CREATE FIRST BOOT SCRIPT section), add this to remove admin rights again:
## Remove upgradeadmin group
/usr/sbin/dseditgroup -o delete -n /Local/Default upgradeadmin
/usr/bin/dsmemberutil flushcache
Thanks for that @crbeck !
I am only looking to reinstall a clean OS on devices at the minute so I might just get the engineers to login with the central admin account and run the policy from Self Service and save myself any extra work. LOL
Is there anyway to get this working on Catalina?
!/bin/bash
/PathTo/Install macOS Catalina.app/Contents/Resources/startosinstall --applicationpath /PathTo/Install macOS Catalina.app --agreetolicense --nointeraction
This might be of use to some people here.
https://www.jamf.com/blog/reinstall-a-clean-macos-with-one-button/
@mmark, run /PathTo/Install macOS Catalina.app/Contents/Resources/startosinstall
with the --usage
option by itself. This will give you your available options. For Catalina, you don't add --applicationpath
and --nointeraction
.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.