Posted on 12-21-2018 09:16 AM
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.
Posted on 12-21-2018 09:22 AM
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.
Posted on 12-21-2018 09:25 AM
@Hugonaut Where would this script go?
Posted on 12-21-2018 09:28 AM
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
Posted on 12-21-2018 09:29 AM
@Hugonaut Thanks for the help and quick response. Will give it a go! Thanks again!
Posted on 12-21-2018 09:36 AM
@achristoforatos You're welcome! Glad to help!
Posted on 12-21-2018 10:49 AM
Will this work form non-admin users?
Posted on 12-21-2018 01:49 PM
@ozab it will since its being ran by your JSS management account
Posted on 12-21-2018 02:09 PM
@Hugonaut Why would you do it via a script instead of the Execute Command located in Files and Processes module?
Posted on 12-21-2018 02:53 PM
@Ricky personal preference, I've always run everything as raw scripts, now done from the jps scripts repo, pre jamf habits =)
Posted on 12-26-2018 06:19 AM
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?
Posted on 12-26-2018 06:24 AM
@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?
Posted on 12-26-2018 06:32 AM
The computer is currently on Mojave and I was trying to test that it would run. Could that be the issue?
Posted on 12-26-2018 06:39 AM
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
Posted on 12-26-2018 06:44 AM
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.
Posted on 12-26-2018 06:53 AM
then you want this script
#!/bin/bash
/PathTo/Install macOS Mojave.app/Contents/Resources/startosinstall --applicationpath /PathTo/Install macOS Mojave.app --agreetolicense --nointeraction
Posted on 12-26-2018 07:34 AM
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.
Posted on 12-26-2018 07:50 AM
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
Posted on 12-26-2018 08:19 AM
Very helpful, thanks for posting this!
Posted on 01-10-2019 11:18 AM
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.
Posted on 10-02-2019 03:24 AM
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?
Posted on 10-02-2019 06:14 AM
@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
Posted on 10-02-2019 06:27 AM
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
Posted on 12-20-2019 08:34 AM
Is there anyway to get this working on Catalina?
/PathTo/Install macOS Catalina.app/Contents/Resources/startosinstall --applicationpath /PathTo/Install macOS Catalina.app --agreetolicense --nointeraction
Posted on 12-20-2019 08:37 AM
This might be of use to some people here.
https://www.jamf.com/blog/reinstall-a-clean-macos-with-one-button/
Posted on 12-21-2019 07:54 AM
@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
.
Posted on 12-31-2019 04:35 AM
so just /Applications/Install macOS Catalina.app/Contents/Resources/startosinstall --agreetolicense in Files and Processes or do I need to make this a script?
Posted on 12-31-2019 04:42 AM
@talkingmoose I checked the policy log for one of the devices and this is what I'm getting now:
[STEP 1 of 4]
Executing Policy macOS Catalina Upgrade
[STEP 2 of 4]
[STEP 3 of 4]
Running command /Applications/Install macOS Catalina.app/Contents/Resources/startosinstall --agreetolicense...
Result of command:
Error: Prepare recovery failed with error: Error Domain=com.apple.OSInstallerSetup.error Code=303 "Installation of macOS could not continue." UserInfo={NSLocalizedDescription=Installation of macOS could not continue., NSLocalizedRecoverySuggestion=Installation requires downloading important content. That content can't be downloaded at this time. Try again later.}
Fetching OS Recovery info from server...
[STEP 4 of 4]
Posted on 12-31-2019 05:28 AM
Haven't read through the entire thread, but I don't see anyone appending && reboot
to the end of their command.
Also any chance the options have changed a bit compared to the above posts (--pidtosignal
, --forcequitapps
, etc.). ?
$ /Applications/Install macOS Catalina.app/Contents/Resources/startosinstall --usage
Usage: startosinstall --volume <target volume path>
Arguments
--license, prints the user license agreement only.
--agreetolicense, agree to the license you printed with --license.
--rebootdelay, how long to delay the reboot at the end of preparing. This delay is in seconds and has a maximum of 300 (5 minutes).
--pidtosignal, Specify a PID to which to send SIGUSR1 upon completion of the prepare phase. To bypass "rebootdelay" send SIGUSR1 back to startosinstall.
--installpackage, the path of a package (built with productbuild(1)) to install after the OS installation is complete; this option can be specified multiple times.
--eraseinstall, (Requires APFS) Erase all volumes and install to a new one. Optionally specify the name of the new volume with --newvolumename.
--newvolumename, the name of the volume to be created with --eraseinstall.
--preservecontainer, preserves other volumes in your APFS container when using --eraseinstall.
--forcequitapps, on restart applications are forcefully quit. This is the default if no users are logged in.
--usage, prints this message.
--volume, path to the target volume.
Example: startosinstall --volume /Volumes/Target
$
I haven't tested this in Catalina yet, seems like an Apple scream test right now..
¯_(ツ)_/¯
This is what we've used with Mojave and High Sierra if it matters:
/Applications/Install macOS Mojave.app/Contents/Resources/startosinstall --agreetolicense --nointeraction && reboot
Posted on 12-31-2019 08:43 AM
@mmark, as part of any upgrade the installer will need to connect to the internet to download firmware onto the Mac. Sounds like your Mac may not be connected to your network or Apple's network had a temporary issue.
If you have a mobile hotspot, that's worth testing as part of your network troubleshooting.
Posted on 12-31-2019 09:46 AM
Its working now, it just takes forever to download all necessary files.
Posted on 01-29-2020 07:57 AM
@donmontalvo Does your reboot append work on File Vaulted machines?
Posted on 01-29-2020 08:23 AM
@Hugonaut Morning, great little script, but what is the process to add it back to Casper at the same time. I remember that you were able to run a package along with erasing or upgrading. Is that still true, do you know? and if so what would that command line be.
Have a great day my friend!
Posted on 03-03-2020 04:22 AM
I'm having issues using https://github.com/kc9wwh/macOSUpgrade script.
It worked fine when upgrading from 10.11 to 10.13.
When trying to upgrade from 10.13 to 10.14 keep getting "We were unable to prepare your computer for macOS Mojave. Please contact the IT Support Center."
It pulls the Mojave installer down but after that it fails .
2020-03-03 12:08:13+00 UKM2315 install_monitor[12420]: Temporarily excluding: /Applications, /Library, /System, /bin, /private, /sbin, /usr
2020-03-03 12:08:13+00 UKM2315 install_monitor[12420]: PackageKit: Locking applications
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: Writing receipt for installmacosmojave to /
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: Touched bundle /Applications/Install macOS Mojave.app
2020-03-03 12:08:13+00 UKM2315 installd[1055]: Installed "Install macOS Mojave" ()
2020-03-03 12:08:13+00 UKM2315 install_monitor[12420]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: releasing backupd
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: allow user idle system sleep
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: ----- End install -----
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: 16.0s elapsed install time
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: Running idle tasks
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: Done with sandbox removals
2020-03-03 12:08:13+00 UKM2315 installer[12419]: PackageKit: Registered bundle file:///Applications/Install%20macOS%20Mojave.app/ for uid 0
2020-03-03 12:08:13+00 UKM2315 installd[1055]: PackageKit: Removing client PKInstallDaemonClient pid=12419, uid=0 (/usr/sbin/installer)
2020-03-03 12:08:14+00 UKM2315 installer[12419]: Running install actions
2020-03-03 12:08:14+00 UKM2315 installer[12419]: Removing temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.12419mTTq1C"
2020-03-03 12:08:14+00 UKM2315 installer[12419]: Finalize disk "UKM2315"
2020-03-03 12:08:14+00 UKM2315 installer[12419]: Notifying system of updated components
2020-03-03 12:08:14+00 UKM2315 installer[12419]:
2020-03-03 12:08:14+00 UKM2315 installer[12419]: * Summary Information *
2020-03-03 12:08:14+00 UKM2315 installer[12419]: Operation Elapsed time
2020-03-03 12:08:14+00 UKM2315 installer[12419]: -----------------------------
2020-03-03 12:08:14+00 UKM2315 installer[12419]: disk 0.02 seconds
2020-03-03 12:08:14+00 UKM2315 installer[12419]: script 0.00 seconds
2020-03-03 12:08:14+00 UKM2315 installer[12419]: zero 0.00 seconds
2020-03-03 12:08:14+00 UKM2315 installer[12419]: install 16.83 seconds
2020-03-03 12:08:14+00 UKM2315 installer[12419]: -total- 16.86 seconds
2020-03-03 12:08:14+00 UKM2315 installer[12419]: