Skip to main content
Jamf Nation, hosted by Jamf, is the largest Apple IT management community in the world. Dialog with your fellow IT professionals, gain insight about Apple device deployments, share best practices and bounce ideas off each other. Join the conversation.

In-Place macOS Sierra Upgrade Script

Hello,

I am trying to follow this guide from JAMF: https://www.evernote.com/shard/s398/sh/bec8a262-e33d-4ad9-80fa-05b939db6d8d/f4ca396a63caa510

I am using the script noted here: https://www.evernote.com/shard/s398/sh/bec8a262-e33d-4ad9-80fa-05b939db6d8d/f4ca396a63caa510/res/9163d1d7-3bbf-4e2f-b70a-0cd447c749a1/startosinstall.sh

I got everything else working so far (you do need another policy to place the .dmg in the applications folder that the article neglects to tell you). I would like the script to force the restart instead of being "soft". I tested it and found that any open application will stop the upgrade.

Just need it to forcibly and immediately preform the restart.

Thanks.

Here is the script:

#!/bin/bash
/Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 30 --nointeraction
killall "Self Service"
Like Comment
SOLVED Posted: 1/17/17 at 2:28 PM by mvu

I like this PDF from JAMF better. Worked well for me.

https://www.evernote.com/shard/s398/sh/bec8a262-e33d-4ad9-80fa-05b939db6d8d/f4ca396a63caa510

Like
SOLVED Posted: 1/17/17 at 6:00 PM by pcrandom

Dumb question: Where are these PDFs from? Can they be found in https://www.jamf.com/resources/?

Like
SOLVED Posted: 1/18/17 at 6:30 AM by TylerC

Hello, I am not debating the PDF. I figured that all out. I just need help with the script.

Thanks.

Like
SOLVED Posted: 1/18/17 at 8:15 AM by seann

Try the command "reboot now". Or you can use use the restart options within the policy.

Like
SOLVED Posted: 1/19/17 at 7:36 AM by TylerC

Where would I be placing that command? I know nothing of scripts unfortunately.

Like
SOLVED Posted: 1/20/17 at 10:05 AM by TylerC

I keep getting this error. Does anyone know what could cause it?

Error:
Script result: Helper tool creashed...
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
No matching processes were found
Error running script: return code was 1.

Like
SOLVED Posted: 1/20/17 at 11:58 AM by seann

I would check your syntax. According to here https://macops.ca/new-adventures-in-automating-os-x-installs-with-startosinstall, the nointeraction flag should suppress the agreement.

No matching process found is probably related to your killall Self Service command, as anything being run via jamf is done in the context of root, while the self service process belongs to the user who launched it.

Finally, "reboot now" would just be another line in your script.

Like
SOLVED Posted: 1/25/17 at 10:37 AM by TylerC

Devices do not even appear to be attempting to upgrade anymore..

I think the problem is here: Script result: Helper tool creashed...
Yes the misspelling is actually from the script.

Nonetheless Jamf gave me the script and we have tried many things to get it working with no success. Currently at a complete stop.

Like
SOLVED Posted: 1/25/17 at 10:45 AM by stevewood

@TylerC might I suggest you go a different route for doing these upgrades? I would highly recommend the process that @rtrouton outlines on his blog:

Providing OS X Upgrades via Casper

I've used that method to go from 10.10 to 10.11 and am using it now to go to 10.12. It's painless, and it works.

Like
SOLVED Posted: 1/26/17 at 6:29 AM by TylerC

I will have to look into it some more. Some looks a bit over my head and we are not using self-service. Overall pretty upset by the lack of support from Jamf.

Like
SOLVED Posted: 1/26/17 at 6:34 AM by stevewood

@TylerC you should be able to utilize Rich's methods without using Self Service. And he does a great job of explaining the details.

I'm assuming you've sent an email in to support@jamf.com, right?

Like
SOLVED Posted: 1/26/17 at 6:43 AM by stevewood

@TylerC sorry, just re-read your earlier post that you had been given the script my Jamf.

I'm not certain what all you have tried, but to get the reboot to happen immediately, but looking at the verbs of the binary (startosinstall) the nointeraction flag does not appear to be there anymore:

Steve-Wood:Resources steve$ ./startosinstall --?
startosinstall: unrecognized option `--?'
Usage: startosinstall --applicationpath <install macOS.app path> --volume <target volume path>

Arguments
--volume, a path to the target volume.
--applicationpath, a path to copy of the OS installer application to start the install with.
--license, prints the user license agreement only.
--agreetolicense, agree to license 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 .
--usage, prints this message.

Example: startosinstall --volume /Volumes/Untitled --applicationpath "/Applications/Install macOS.app"

So, I would modify the script as follows:

#!/bin/bash
/Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 1

Since you are not using Self Service the killall "Self Service" can be removed. As the help on the binary states, the rebootdelay is in seconds, so setting that to 1 should reboot within 1 second of completing preparations.

I have not tested this just yet, but when I get to the office I will try to replicate this in a VM.

Like
SOLVED Posted: 1/26/17 at 3:04 PM by stevewood

@TylerC after countless reboots of my VM and countless restores back to a snapshot, I had success with the method you are trying. I utilzed the script you posted (I was wrong about the nointeraction verb):

#!/bin/bash

/Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 1 --nointeraction

I did not cache the OS because I did not want to put that into my JSS. I copied the Install macOS Sierra app into the Applications folder on the VM, added the above script, and then created a policy that was triggered to At Login with the script. That method worked perfectly.

The only time I had any issues was when I tried to trigger the policy during Recurring Check In. For whatever reason I had mixed results, more often than not resulting in failure.

Not sure how you are triggering this policy, but you might need to look at how you get the policy started.

Like
SOLVED Posted: 2/11/17 at 9:58 PM by VladCabrera

I was provided this script for an upgrade without user interaction. I am still testing and only found that the messages are being sent to system event. this is causing an error when the policy is run.

https://github.com/kc9wwh/macOSUpgrade

Like
SOLVED Posted: 2/13/17 at 9:15 AM by Rosko

@VladCabrera Could you provide me with some more details on the issues you are seeing with that workflow? I've tested it on a few systems now with no issue, so very curious as to what you are seeing.

Like
SOLVED Posted: 2/13/17 at 9:37 AM by VladCabrera

@Rosko Thanks for joining. I have 2 policy one delivers a dmg created with Composer, that drops Install Sierra.app to Users/Shared/ with 755 permissions. Owner is root(0) RWX, Group wheel(0) RX, Everyone RX.

The script is set as a separate policy with priority set to after. I can see the machines, Yosemite and EL Capitan, download and attempt to execute but fails with error.

Executing Policy macOS Sierra Silent Install
Running script macOS10.12Upgrade...
Script exit code: 0
Script result: 36:258: execution error: An error of type -10810 has occurred. (-10810)

I'm thinking jamfhelper can't tell the logged on user to send the message and quits.

My hardware are all Mac mini.

If I run the script manually, ./macupgrade.sh it skips to startosinstall command.

Like
SOLVED Posted: 2/13/17 at 10:11 AM by Rosko

@VladCabrera Attached is an updated script with some echoes to let us see in the policy logs what is happening. But one thing to note is that we are sending jamfHelper and startosinstall to background processes so the script should actually complete and the processes will still be running until the startosinstall process initiates the reboot.

But if you could run the below script and let me know the output, as well as if you are seeing the jamfHelper screen or not.

#!/bin/bash

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
#
# Copyright (c) 2017 Jamf.  All rights reserved.
#
#       Redistribution and use in source and binary forms, with or without
#       modification, are permitted provided that the following conditions are met:
#               * Redistributions of source code must retain the above copyright
#                 notice, this list of conditions and the following disclaimer.
#               * Redistributions in binary form must reproduce the above copyright
#                 notice, this list of conditions and the following disclaimer in the
#                 documentation and/or other materials provided with the distribution.
#               * Neither the name of the Jamf nor the names of its contributors may be
#                 used to endorse or promote products derived from this software without 
#                 specific prior written permission.
#
#       THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY
#       EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
#       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
#       DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY
#       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
#       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
#       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
#       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#       SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# 
# This script was designed to be used in a Self Service policy to ensure specific
# requirements have been met before proceeding with an inplace upgrade to macOS Sierra, 
# as well as to address changes Apple has made to the ability to complete macOS upgrades 
# silently. 
#
# REQUIREMENTS:
#           - Jamf Pro
#           - macOS Sierra Installer must be staged in /Users/Shared/
#
#
# For more information, visit https://github.com/kc9wwh/macOSUpgrade
#
#
# Written by: Joshua Roskos | Professional Services Engineer | Jamf
#
# Created On: January 5th, 2017
# Updated On: February 13th, 2017
# 
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# USER VARIABLES
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

##Enter 0 for Full Screen, 1 for Utility window (screenshots available on GitHub)
userDialog=0

##Title to be used for userDialog (only applies to Utility Window)
title="macOS Sierra Upgrade"

##Heading to be used for userDialog
heading="Please wait as we prepare your computer for macOS Sierra..."

##Title to be used for userDialog
description="
This process will take approximately 5-10 minutes. 
Once completed your computer will reboot and begin the upgrade."

##Icon to be used for userDialog
##Default is macOS Sierra Installer logo which is included in the staged installer package
icon=/Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/InstallAssistant.icns

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# SYSTEM CHECKS
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

##Check if device is on battery or ac power
pwrAdapter=$( /usr/bin/pmset -g ac )
if [[ ${pwrAdapter} == "No adapter attached." ]]; then
    pwrStatus="ERROR"
    /bin/echo "Power Check: ERROR - No Power Adapter Detected"
else
    pwrStatus="OK"
    /bin/echo "Power Check: OK - Power Adapter Detected"
fi

##Check if free space > 15GB
freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' )
if [[ ${freeSpace%.*} -ge 15 ]]; then
    spaceStatus="OK"
    /bin/echo "Disk Check: OK - ${freeSpace%.*} Free Space Detected"
else
    spaceStatus="ERROR"
    /bin/echo "Disk Check: ERROR - ${freeSpace%.*} Free Space Detected"
fi

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# APPLICATION
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

if [[ ${pwrStatus} == "OK" ]] && [[ ${spaceStatus} == "OK" ]]; then
    ##Launch jamfHelper
    if [[ ${userDialog} == 0 ]]; then
        /bin/echo "Launching jamfHelper as FullScreen..."
        /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -title "" -icon "$icon" -heading "$heading" -description "$description" &
        jamfHelperPID=$(echo $!)
    fi
    if [[ ${userDialog} == 1 ]]; then
        /bin/echo "Launching jamfHelper as FullScreen..."
        /Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "$heading" -description "$description" -iconSize 100 &
        jamfHelperPID=$(echo $!)
    fi

    ##Begin Upgrade
    /bin/echo "Launching startosinstall..."
    /Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --volume / --applicationpath /Users/Shared/Install\ macOS\ Sierra.app --nointeraction --pidtosignal $jamfHelperPID &
    /bin/sleep 3
else
    /bin/echo "Launching AppleScript Dialog..."
    /usr/bin/osascript -e 'Tell application "System Events" to display dialog "Your computer does not meet the requirements necessary to continue.

    Please contact the help desk for assistance. " with title "macOS Sierra Upgrade" with text buttons {"OK"} default button "OK" with icon 2'
fi

exit 0

Thanks!
Josh

Like
SOLVED Posted: 2/13/17 at 1:57 PM by dan.snelson

Thanks @Rosko!

For those Macs which are on older versions of macOS 10.12.x and already have current version of /Applications/Install macOS Sierra.app, we added logic to determine the free space on a Sierra box:

## Determine free space ...
osMinorVersion=$( /usr/bin/sw_vers -productVersion | /usr/bin/cut -d. -f2 )
if [[ "$osMinorVersion" -lt 12 ]]; then
    freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' )     
else
    freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $4}' )
fi
Like
SOLVED Posted: 2/13/17 at 5:45 PM by Rosko

@dan.snelson You beat me to the punch! lol

The next version will have the updated support for running on macOS 10.12, just didn't think it would be needed till 10.13 ;)
I took a little different approach, but the end result is the same...

##Check if free space > 15GB
if [[ $osMinor -ge 12 ]]; then
    freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $4}' )
else
    freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' )
fi

if [[ ${freeSpace%.*} -ge 15 ]]; then
    spaceStatus="OK"
    /bin/echo "Disk Check: OK - ${freeSpace%.*} Free Space Detected"
else
    spaceStatus="ERROR"
    /bin/echo "Disk Check: ERROR - ${freeSpace%.*} Free Space Detected"
fi

But, I'm curious...are you using the installer to upgrade minor versions versus a combo update or did I miss read that?

Like
SOLVED Posted: 2/14/17 at 10:19 AM by VladCabrera

@Rosko Ran into one with the script and my Mac mini's. it doesn't like the power management query in which fails because it seems to look for only an adapter. These are my only test machine at the moment.

After removing the power check, I was able to run the script but stuck at the preparing banner for 50 minutes. I killed the PID for jamfhelper.

Results. TUSMA03MDKVT007:Shared v781598$ vim MacOSSierra_Pwr.sh TUSMA03MDKVT007:Shared v781598$ ./MacOSSierra_Pwr.sh Disk Check: OK - 476 Free Space Detected
Launching jamfHelper as FullScreen...
Launching startosinstall...
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
TUSMA03MDKVT007:Shared v781598$ Error: could not get authorization...

Like
SOLVED Posted: 2/14/17 at 11:19 AM by Rosko

@VladCabrera Thanks for the Update! That was definitely not intended behavior.

I've updated the script on GitHub w/ the following:
- Replaced Final AppleScript Dialog w/ jamfHelper
- Added Output for Policy Logs
- Added Support for macOS 10.12 + for Free Space Check
- Fixed Issue with Power Check Only Applies to Laptops

I've tested this on a MacBook Pro, MacMini and a Mac VM, and all the way back to 10.8 so hopefully that should work for you :)

Like
SOLVED Posted: 2/14/17 at 11:27 AM by dan.snelson

@Rosko Nice updates.

Since you're being your usual, helpful self, I added the following snippet to use Parameter 4 to validate which version of the installer is present client-side (i.e., "10.12.3").

(I am looking for the installer in /Applications/)

## Script Parameter
requiredInstallerVersion="$4"         # Required Installer Version

## Check if the available installer is the appropriate version
installerVersion=$( /usr/bin/defaults read /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallInfo.plist "System Image Info" | /usr/bin/grep version | /usr/bin/awk '{print $3}' | /usr/bin/tr -d '";' )

# Validate a value has been specified for Parameter 4 ...
if [ ! -z "${requiredInstallerVersion}" ]; then

    if [[ "${requiredInstallerVersion}" == "${installerVersion}" ]]; then

        installerVersionCheck="OK"

    else

        installerVersionCheck="ERROR"

    fi

else

    installerVersionCheck="ERROR: Version not specified"
    jssLog "ERROR: Parameter 4 not specified"

    exit 1

fi
Like
SOLVED Posted: 2/14/17 at 8:00 PM by VladCabrera

Still running into issues completing the task. Getting stuck on trying to run startosinstall command.

tma0029avkvtad:Shared Setup$ ./macOS10.12Upgrade.sh Power Check: OK - AC Power Detected
Disk Check: OK - 44GB Free Space Detected
Launching jamfHelper as FullScreen...
Launching startosinstall...
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
Error: could not get authorization...
tma0029avkvtad:Shared Setup$ ps PID TTY TIME CMD 678 ttys000 0:00.01 -bash 934 ttys001 0:00.01 -bash 961 ttys001 0:00.18 /Library/Application Support/JAMF/bin/jamfHelper.app/C
tma0029avkvtad:Shared Setup$

I took the above by ssh to the computer. Manually I gave the script 755 rights, but we have limited the sudo command to particular files and commands. I have to work on getting this script added to the allowed list.

Like
SOLVED Posted: 2/14/17 at 9:09 PM by dan.snelson

@VladCabrera For what it's worth, here's the install command I'm using (but the installer is in /Applications):

/Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 30 --nointeraction
Like
SOLVED Posted: 2/15/17 at 3:30 PM by VladCabrera

@dan.snelson @Rosko When you did your testing was it via policy or manually? I am able to invoke the script manually with sudo ./macOS10.12Upgrade.sh.

Like
SOLVED Posted: 2/15/17 at 3:39 PM by dan.snelson

@VladCabrera We're running ours via a Self Service policy.

Like
SOLVED Posted: 2/15/17 at 4:23 PM by Rosko

Thanks @dan.snelson I plan to eventually do something similar I think (just need time). Basically will check if there is already the "Install macOS Sierra.app" in the Applications folder and if the version matches use that. Otherwise we'll download (call another policy) to download the latest version we have and use that for the process. Shouldn't take much to do, just time.

@VladCabrera All my testing was done using Self Service (so, basically script is run as root). As you have stated, it appears to be hanging on the startosinstall command. What version of the macOS Sierra installer app file are you trying to use and on what OS version? Also, with the installer on the end-point, can you try running the below command and see if the command itself works?

/path/to/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --volume / --applicationpath /path/to/Install\ macOS\ Sierra.app --nointeraction

You can also check out /var/log/install.log to see if there is any other errors there, but running this manually you should see a lot more information.

Like
SOLVED Posted: 2/15/17 at 10:17 PM by Dalmatian

@TylerC @stevewood

any luck on this error? i got the same error
Error:
Script result: Helper tool creashed...
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
No matching processes were found
Error running script: return code was 1.

Like
SOLVED Posted: 2/15/17 at 10:28 PM by stevewood

@Dalmatian if you look at my last post, the only time I was able to successfully utilize that method was if I triggered the installation via a Login trigger on the policy. I did not try using Self Service, if I recall.

How are you triggering this? And have you looked at the other methods mentioned? Like Rich's method I posted in the first post I did. I've been using that method since 10.10 with no issues.

Like
SOLVED Posted: 2/15/17 at 10:32 PM by Dalmatian

@stevewood

I've tried with a mixed trigger. but just changed it to Login only.

and funny thing is, i ran the command line manually in terminal and still got error, and upgrade can't proceed.

any idea?

Like
SOLVED Posted: 2/16/17 at 8:15 AM by stevewood

@Dalmatian can you post the line in your script where you are calling the installer? It should be like what is posted above:

/path/to/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --volume / --applicationpath /path/to/Install\ macOS\ Sierra.app --nointeraction

I would take that line and try running it from within Terminal to see if it works.

Like
SOLVED Posted: 2/16/17 at 11:17 AM by VladCabrera


running startosinstall manually will ask for my password to confirm I want to continue. Same thing with running Joshua's script sudo ./MacOS10.12upgrade.sh. I put both the script and the installer app in the same folder. The new policy is a command #/bin/sh -v -x /Users/Shared/MacOs10.12upgrade.sh

Execute Command
Command to execute on computers. This command is executed as the "root" user

/bin/sh -v -x /Users/Shared/MacOs10.12upgrade.sh

I put it in this location and remove the script because my understanding is that when it is in the script section the policy will run as the current user.

Like
SOLVED Posted: 2/17/17 at 10:31 AM by Rosko

@VladCabrera Is it working for you when running the script that way? I unfortunately haven't seen this issue anywhere else so kinda at a loss of how to suppress that as it should be done via the -nointeraction switch.

I also wanted to clarify that when ever you run a script from the JSS whether in a check-in policy or via Self Service it is run as root when executed.

Like
SOLVED Posted: 2/17/17 at 11:30 AM by VladCabrera

@Rosko When in doubt start from the beginning. That's my quote of the day.

I downloaded the script from GitHub again. This time I didn't open it with TextEdit. My default TextEdit format is .rft. So think my original issues may have been with how TextEdit change file data. Can't confirm but didn't care after working on 2 mac mini's this time around.

My new JAMF policies are: 1. download a copy of the Installer Sierra.app file into /Users/Shared and update inventory. 2. Enable the script as a Self Service policy for the logged on user to run from Self Service

This method has worked great thus far during lab testing. I was comfortable in the results enough to attempt another type of policy in which the policy is not available to the user in Self Service for an upgrade button. The idea is to force the upgrade from 10.10 and below OS. Let say a user loves their maverick machine and doesn't want to upgrade even if its available. As Mr. bad guy I can say your machine is being upgraded anyway.

Like
SOLVED Posted: 2/17/17 at 1:42 PM by Rosko

@VladCabrera Awesome! Glad to hear everything is working now. This issues was bothering me, so glad its working now :)

Have a great weekend!
~Josh

Like
SOLVED Posted: 3/15/17 at 1:33 PM by rqomsiya

The script uploaded by Josh from JAMF seems to never complete on some of my machines. Here is the output log from the JSS:

[STEP 1 of 5] Executing Policy macOS Sierra Upgrade [STEP 2 of 5] Running script macOS_Sierra_10.12.x_upgrade.sh... Script exit code: 0 Script result: Power Check: OK - AC Power Detected Disk Check: OK - 962GB Free Space Detected Launching jamfHelper as FullScreen... Launching startosinstall... [STEP 3 of 5] [STEP 4 of 5] Inventory will be updated when all queued actions in Self Service are complete. [STEP 5 of 5]

The JAMFHelper screen just stays up, but self-service has finished running the policy. I'm lost as to why its working on some machines but not others. I have not modified the script

Like
SOLVED Posted: 3/15/17 at 1:33 PM by rqomsiya

The script uploaded by Josh from JAMF seems to never complete on some of my machines. Here is the output log from the JSS:

[STEP 1 of 5] Executing Policy macOS Sierra Upgrade [STEP 2 of 5] Running script macOS_Sierra_10.12.x_upgrade.sh... Script exit code: 0 Script result: Power Check: OK - AC Power Detected Disk Check: OK - 962GB Free Space Detected Launching jamfHelper as FullScreen... Launching startosinstall... [STEP 3 of 5] [STEP 4 of 5] Inventory will be updated when all queued actions in Self Service are complete. [STEP 5 of 5]

The JAMFHelper screen just stays up, but self-service has finished running the policy. I'm lost as to why its working on some machines but not others. I have not modified the script .

Like
SOLVED Posted: 3/15/17 at 3:38 PM by bpavlov
Like
SOLVED Posted: 3/15/17 at 4:46 PM by rqomsiya

Hi @bpavlov I would go that route except one of our requirements was zero user interaction. As we have FV2 enabled the above workflow would require users to authenticate against FV2 to finish the installation.

I actually was able to get the script working by flushing user and system caches via policy.

Thanks for the feedback though!

Like
SOLVED Posted: 3/30/17 at 7:01 PM by Kumarasinghe

With 10.12.4 Updater Apple changed some things with startosinstall:
--volume argument is not needed.

On OS X 10.11.6:
--volume is not a valid option if you run on a OS X 10.11 Mac and command will fail.
Upgrade tool works fine without --volume argument

On OS X 10.8.5:
--volume available on 10.8
Upgrade command doesn't work properly (error: Helper tool creashed)
To get it working you need to open the Installer app once via GUI and then run the command.
We have an active AppleCare Enterprise Services case about this.

To get 10.12.4 upgrade working via scripted method we have to do 2 things:
1. Let it open the installer app and close quickly.
2. Run the startosinstall command with no --volume argument.

#!/bin/sh
# All Glory and Thanks to Jesus!

macOSinstallerAppPath="/Applications/Install macOS Sierra.app"

CurrentloggedInUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')

# There was an issue with startosinstall command that "Install macOS..app" needs to be opened once by logged in user to get it working properly
effectiveUserID=$(/usr/bin/id -u "$CurrentloggedInUser")
/bin/launchctl asuser "$effectiveUserID" sudo -u "$CurrentloggedInUser" /usr/bin/osascript <<EOT
        tell application "${macOSinstallerAppPath}" to activate
EOT
# Wait for 5 seconds to settle down then quit the app
/bin/sleep 5
/bin/launchctl asuser "$effectiveUserID" sudo -u "$CurrentloggedInUser" /usr/bin/osascript <<EOT
        tell application "${macOSinstallerAppPath}" to quit
EOT

# Run upgrade command
"${macOSinstallerAppPath}/Contents/Resources/startosinstall" --applicationpath "${macOSinstallerAppPath}" --rebootdelay 30 --nointeraction

# Reboot immediately if it has not rebooted by 'startosinstall'
/usr/local/jamf/bin/jamf reboot -background -immediately

exit 0

Apple also changed the way how Internet Recovery works.
Initial Internet Recovery will recover to the macOS it came with and once you have upgraded to macOS 10.12.4 the next Internet Recovery attempt will recover to 10.12.4 instead of the OS it came with.

Like
SOLVED Posted: 5/4/17 at 3:00 PM by VladCabrera

@Rosko , Josh, I showed Leslie last week what we are trying to do with the installer. We noticed that when we use the script in a policy then as a executed command (Files and Processes) it will not complete because it can't not close open applications.

We have a policy that downloads the installer and the script into /Users/Shared/ then a second that Executes the bash script.

What would be your preferred method of sending a killall command to the machine? User script in the same policy?

Like
SOLVED Posted: 5/5/17 at 10:22 AM by Rosko

@VladCabrera As it sounds like the workflow has been modified, I really can't speak entirely too it without seeing it. But you shouldn't have to do a killall since there should be a & at the end of the line that calls the startosinstall in the script like this /Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath /Users/Shared/Install\ macOS\ Sierra.app --nointeraction --pidtosignal $jamfHelperPID &.

This ensure that the macOS Sierra Installer will run as a background process and not "hold up" the script.

Like
SOLVED Posted: 5/19/17 at 4:00 PM by dstranathan

My policy and script script are working fine. However, when the 10.12.5 Install macOS Sierra.app starts (from /Applications folder) I get this error below.

Is it booting/installing from the wrong volume?

Has anyone seen this before?

Like
SOLVED Posted: 5/24/17 at 2:43 PM by ryan.ball

I got the 10.12.4 installer to work using Rosko's vanilla workflow. Using the 10.12.5 installer I kept seeing the following errors in the policy log:

"/Users/Shared/Install macOS Sierra.app/Contents/Resources/startosinstall" --applicationpath "/Users/Shared/Install macOS Sierra.app" --nointeraction By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms. If you do not agree, press CTRL-C and cancel this process immediately. Error: __28-[OSISClient targetForPath:]_block_invoke, Couldn’t communicate with a helper application. Error: could not find target... Helper tool creashed...

In the system's install.log I saw this:

osinstallersetupplaind[2321]: Multiple clients attempting to connect to osinstallersetupd

So I added this bit of code before the startosinstall command

/usr/bin/killall osinstallersetupplaind
/bin/sleep 2

This seems to resolve the issues I had

Like
SOLVED Posted: 5/26/17 at 8:14 AM by dstranathan

This post by @jbourdon did the trick for me.

https://www.jamf.com/jamf-nation/discussions/21563/macos-install-in-place-error

Like
SOLVED Posted: 6/20/17 at 8:23 PM by AIR

Let me start out by saying that we're not a jAMF shop yet, trying to convince my bosses to go this route.

What I ended up doing was creating a payload-free package, with the Sierra Installer App in the Scripts folder along with a few other bits.

The postinstall script looks like this:

#!/bin/bash

WORKDIR=$(dirname $0)
APP="$WORKDIR/Install macOS Sierra-10.12.5.app"

if [[ -d "$APP" ]]; then
    logger -s "Starting  Sierra InPlace Upgrade..."

     "$APP/Contents/Resources/startosinstall" --applicationpath "$APP" --agreetolicense --rebootdelay 10 --nointeraction
     sleep 5

     logger -s "Shutting Down osinstallersetupd Process.."
     sudo killall "osinstallersetupd" 2>/dev/null

     logger -s "Beginning Authenticated Reboot..."
     /usr/bin/fdesetup authrestart -inputplist < "$WORKDIR/authrestart.plist"
else
    logger -s "$APP not found.  Aborting..."
    exit 1
fi

exit 0

We have a full-screen Cocoa app I created, that prevents the user from interacting with the system while the initial steps are taking place (think jAMF helper). This effectively blocks any soft-reboot from startosinstall. Apparently, when it reaches the stage where the rebootdelay kicks in, startosinstall is already done and the postinstall moves on to the next item in the script.

At that point, we perform an authenticated reboot ourselves, which will sigkill all running applications.

Since the installer binary unpacks the package to a temp directory and then cleans up after it's done, we don't have to bother with removing the macOS Sierra Installer app, or the plist used to do the authreboot.

Just wanted to share this alternate approach, since I've learned a lot from the members of this forum!

AIR.

Like
SOLVED Posted: 6/26/17 at 9:47 AM by VladCabrera

Has anyone experienced with the 10.12.5 installer that some machines will run the startosinstall prep the drive but when it restarts it will boot back to the old OS. In other words, the upgrade will not run during the reboot. I have tested with just the startosinstall command and switches.

Running command /Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Users/Shared/Install macOS Sierra.app" --nointeraction...
Result of command:
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
Preparing to run macOS Installer...
Preparing 1.492537...
Preparing 1.492537...
Preparing 1.492537...
Preparing 1.492611...
Preparing 2.388166...
Preparing 3.283721...
Preparing 4.179275...
Preparing 5.074830...
Preparing 5.970384...
Preparing 6.865939...
Preparing 7.761493...
Preparing 8.657048...
Preparing 9.552602...
Preparing 10.448157...
Preparing 11.343711...
Preparing 12.239266...
Preparing 13.134821...
Preparing 14.030375...
Preparing 14.925930...
Preparing 15.821484...
Preparing 16.717039...
Preparing 17.612593...
Preparing 18.508148...
Preparing 19.403702...
Preparing 20.299257...
Preparing 21.194811...
Preparing 22.090366...
Preparing 22.985921...
Preparing 23.881475...
Preparing 24.777030...
Preparing 25.672584...
Preparing 26.568139...
Preparing 27.463693...
Preparing 28.359248...
Preparing 29.254802...
Preparing 30.150357...
Preparing 31.045911...
Preparing 31.941466...
Preparing 32.837020...
Preparing 33.732575...
Preparing 34.628130...
Preparing 35.523684...
Preparing 36.419239...
Preparing 37.314793...
Preparing 38.210348...
Preparing 39.105902...
Preparing 40.001457...
Preparing 40.897011...
Preparing 41.792566...
Preparing 42.688120...
Preparing 43.583675...
Preparing 44.479230...
Preparing 45.374784...
Preparing 46.270339...
Preparing 47.165893...
Preparing 48.061448...
Preparing 48.957002...
Preparing 49.852557...
Preparing 50.748111...
Preparing 51.643666...
Preparing 52.539220...
Preparing 53.434775...
Preparing 54.330329...
Preparing 55.225884...
Preparing 56.121439...
Preparing 57.016993...
Preparing 57.912548...
Preparing 58.808102...
Preparing 59.703657...
Preparing 60.599211...
Preparing 61.494766...
Preparing 62.390320...
Preparing 63.285875...
Preparing 64.181429...
Preparing 65.076984...
Preparing 65.972539...
Preparing 66.868093...
Preparing 67.763648...
Preparing 68.659202...
Preparing 69.554757...
Preparing 70.450311...
Preparing 71.345866...
Preparing 72.241420...
Preparing 73.136975...
Preparing 74.032529...
Preparing 74.928084...
Preparing 75.823638...
Preparing 76.719193...
Preparing 77.614748...
Preparing 78.510302...
Preparing 79.405857...
Preparing 80.301411...
Preparing 81.196966...
Preparing 82.092520...
Preparing 82.988075...
Preparing 83.883629...
Preparing 84.779184...
Preparing 85.674738...
Preparing 86.570293...
Preparing 87.465848...
Preparing 88.361402...
Preparing 89.256957...
Preparing 90.152511...
System going down for install...

The machine reported back in with having 10.10 installed.

Like
SOLVED Posted: 6/26/17 at 10:36 AM by a.stonham

@VladCabrera yes we are seeing this also. It seems to work. When you run the script a second time.

Like
SOLVED Posted: 6/26/17 at 11:12 AM by VladCabrera

@a.stonham Any thoughts as to why that happens. I'm reviewing the log from the time that the installation started and comparing it to one that I ran the installer manually. Thus far nothing is jumping out at me.

Like
SOLVED Posted: 7/14/17 at 12:31 PM by dgreening

Let me just say that it is COMPLETELY RIDICULOUS that Jamf has not updated their built-in reboot options to support macOS Sierra upgrades. Sierra has been out for almost a year, and ever since 10.12.4 this functionality is BROKEN. So much for zero day support, eh guys?

I'm sure they will blame Apple... Tell you what, you guys are the device management system which Apple pretty much suggests that customers go with, yet there are many many MANY open PIs which affect core functionality. Even Munki has a workflow which works for Sierra upgrades. We CANNOT wait for 10 for the multitude of things which are currently broken to be fixed. It looks bad for Jamf when we have to try to hack around what used to be standard and streamlined processes.

Like
SOLVED Posted: 7/18/17 at 9:24 AM by seann

@dgreening In all fairness, Apple has changed the upgrade utility a few times. That being said, Jamf should be well aware of these changes in advance, considering their supposed partnership with Apple.

Like
SOLVED Posted: 8/14/17 at 4:44 PM by WUSLS

Second what @seann said!!! We should not have to use bubble gum and bailing wire to get this working.

Like
SOLVED Posted: 8/15/17 at 2:16 PM by Kyuubi

Anyone got this working with the 10.12.6 installer?

Like
SOLVED Posted: 8/15/17 at 2:35 PM by bpavlov

@Kyuubi Gotten what working? There's a few methods/scripts that have been proposed that from what I can tell continue to work with 10.12.6 assuming they've been maintained for the changes that Apple made in 10.12.4.

Like
SOLVED Posted: 8/15/17 at 2:50 PM by Kyuubi

Sorry @bpavlov I didn't read all the posts before i posted. I was thinking that people were still using the old way of stripping the installOSX from the installer.app instead of using the OSInstaller.app. I'll go back to reading now.

Like
SOLVED Posted: 8/22/17 at 10:38 AM by gshackney

@Rosko I have a question. I am looking to have the machine immediately run a recon command after it reboots after the upgrade. Is there a way to trigger this by injecting a line in the post install script? Or in the launchDaemon?
Also it seems the version check is broken so I had to hash out all the lines of code performing the check and re download of the installer. Otherwise script is working great. I just need it to update inventory and run a few other policies on the 1st boot after it upgrades (or have them run on first login after that, but since it doesn't know it has 10.12.6 yet it makes it hard to find a good scope).
Gabe Shackney
Princeton Public Schools

Like
SOLVED Posted: 8/22/17 at 10:43 AM by dan.snelson
Like
SOLVED Posted: 8/22/17 at 10:52 AM by Rosko

@gshackney It would have to be a launchDaemon that gets deployed in order to do a post-reboot recon. And @dan.snelson 's script looks good. The only thing I might do is instead of waiting 300 seconds, use the jamf checkJSSConenection verb to check if the machine is able to establish a connection to the JSS or not. If not, have it wait another 3-5 seconds.

Also, @dgreening, @seann, @WUSLS, @Kyuubi, @bpavlov and anyone else interested in native (Jamf) in-place upgrades, check out the beta of Jamf Pro v9.101. Also, if you are using VPP, you can deploy the macOS Installer that way as well, however you are not able to pre-cache it using this method so a caching server is highly recommended for mass-deployments.

Like
SOLVED Posted: 8/22/17 at 11:34 AM by gshackney

@dan.snelson @Rosko Thanks!
I'll play with this piece. I didn't scan through it too much, does the daemon delete itself after running? Also does it skip running until after the os upgrade reboots into itself once? I basically want to trigger the recon then once the JSS sees that it has run the upgrade policy and now has the new os, then I will have some policies run based on that.
Gabe Shackney
Princeton Public Schools

Like
SOLVED Posted: 8/22/17 at 11:46 AM by dan.snelson

@gshackney Yes, it self-destructs:

# Delete launchd plist
ScriptLog \"* Delete $plistLabel.plist ...\"
/bin/rm -fv /Library/LaunchDaemons/$plistLabel.plist

# Delete script
ScriptLog \"* Delete script ...\"
/bin/rm -fv /path/to/client-side/scripts/reconAtReboot.sh

Here's the way we're deploying the script:

Like
SOLVED Posted: 9/8/17 at 7:26 AM by dan.snelson

Initial results look good for macOS High Sierra 10.13 Beta (17A360a):

/Applications/Install\ macOS\ High\ Sierra\ Beta.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS High Sierra Beta.app" --converttoapfs YES --rebootdelay 30 --nointeraction
Like
SOLVED Posted: 9/8/17 at 10:27 AM by tranatisoc

I executed this script: https://github.com/kc9wwh/macOSUpgrade/blob/master/macOS10.12Upgrade.sh

after confirming macbook is plugged in to power and has enough disk space, i'm getting this screen:

'please wait as we prepare your computer for macos sierra....

this process will take ~5-10mins. once completed your computer will reboot and begin the upgrade.'

it's been on the same screen > 30mins and has not rebooted. did something go wrong? am i missing something?

thanks for any assistance

Like
SOLVED Posted: 9/8/17 at 12:51 PM by bpavlov

@dan.snelson You don't need --converttoapfs YES as it will automatically convert if the hardware supports it. That's been my experience in VMs anyways. Has your testing had different results?

Like
SOLVED Posted: 9/20/17 at 12:03 PM by mbezzo

Hi All,
Does anybody have suggestions on modifying Josh's script (https://github.com/kc9wwh/macOSUpgrade/blob/master/macOSUpgrade.sh) to force a reboot? The soft reboot just isn't cutting it for us - seems there's always an app open and then the reboot just doesn't happen. Timing-wise I'm just not sure where to drop the reboot now command. Any ideas?

Thanks,
Matt

Like
SOLVED Posted: 9/20/17 at 12:45 PM by bpavlov

Try adding shutdown -r now in the line after it finishes running the startosinstall command.

Like
SOLVED Posted: 9/29/17 at 11:51 AM by mrhollywoodgates

@Rosko I've been trying to get the script to run and keep getting this error:

Launching jamfHelper as FullScreen...
Launching startosinstall...
Error: __28-[OSISClient targetForPath:]_block_invoke, Couldn’t communicate with a helper application.
Error: could not find target...
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.

I'm trying to run it as a recurring check-in policy instead of a Self Service policy, but it gets the same error in Self Service, too. I'm trying this on 10.9.5. Any thoughts?

Like
SOLVED Posted: 10/2/17 at 11:13 AM by Rosko

Hello @mrhollywoodgates -

I have not seen this error before...has the script been modified? Also, please be sure to right-click and download the .sh file and not copy paste from the browser as that can sometimes throw in some hidden characters. Otherwise if the script hasn't been modified, I would try running the script locally on the target system and see if you get the same issue. If you continue to get the same issue its usually best to run the script line-by-line to see exactly where the problem is. Based on the what you've provided I'm assuming the script is failing when calling the startosinstall binary.

Also, are you removing all the calls for jamfHelper? Are you able to provide a copy of the script?

Like
SOLVED Posted: 10/2/17 at 11:53 AM by mrhollywoodgates

@Rosko I have not modified the script except for the user variables. I did a lot of testing and reading other posts, and what ended up working for me was a suggestion someone had about having to launch the Installer app as the logged-in user before running it via script. I added this to the script and now it works as expected. I also changed the installer app variables to hard paths as part of troubleshooting. I've now tested it on 10.9 and 10.10 and it works on both platforms.

##Begin Upgrade
    /bin/echo "Launching startosinstall..."
    consoleUser=`ls -l /dev/console | cut -d " " -f4`
    effectiveUserID=$(/usr/bin/id -u "$consoleUser")
    /bin/launchctl asuser "$effectiveUserID" sudo -u "$consoleUser" /usr/bin/open /Applications/Install\ macOS\ Sierra.app
    sleep 5
    /bin/launchctl asuser "$effectiveUserID" sudo -u "$consoleUser" osascript -e 'quit app "Install macOS Sierra"'
    /Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --nointeraction --pidtosignal $jamfHelperPID &
    /bin/sleep 3
Like
SOLVED Posted: 10/2/17 at 12:52 PM by Rosko

@mrhollywoodgates I am glad you were able to solve the problem. I have heard of some folks needing to do this, however I have not been able to duplicate the need to launch the app and then close it, nor do many of the customers we have using this workflow have had to do this, so I don't really know what is causing it. But thanks again for the feedback and the solution. I will keep it in mind in the future if someone else should have the issue.

Have a great day!
Josh

Like
SOLVED Posted: 10/2/17 at 3:03 PM by Eigger

@Rosko Sir, can you be so kind to give me an example that you can add in the beginning of your script that can do a User Files Clean up, user keychain clean up, and flush policy history. And maybe a Prompt to change Computername before the Upgrade executes? I am thinking of just using the Self Service for summer machine refresh. Since Jamf Pro 10 can do 3rd Party Patch update, and the super useful MAU Caching Server and AUSTT, there is no need for us to reimage machines during summer roll outs. Plus we cannot image anymore anyways because of High Sierra.

Like
SOLVED Posted: 10/11/17 at 3:32 PM by jamesandre

I've been testing this for High Sierra upgrades, first two worked OK, then I had "could not find target" errors.

<br/>Error: could not find target...<br/>By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.<br/>If you do not agree, press CTRL-C and cancel this process immediately.<br/>

Turns out that you can't do this while FileVault is doing it's initial encryption.

"You may not install to this volume because it is currently converting to Core Storage."

Like
SOLVED Posted: 10/12/17 at 5:46 PM by bcrockett

I just tested the VPP --> self-service workflow for the 10.13.0 macOS High Sierra upgrade.

As predicted it asked for an administrator username and password before starting the installation.

Is there a solution that allows for this workflow without requiring the admin credentials?

Like
SOLVED Posted: 10/12/17 at 8:01 PM by donmontalvo

Really wish Apple would give a command similar to this, but for macOS upgrades:

sudo softwareupdate --background-critical
Like
SOLVED Posted: 10/27/17 at 1:57 PM by jriv

@Rosko,

Thanks for the upgrade script. It's working great. I do have one request, can you add a:

diskutil verifyVolume (bootdisk)

I had one upgrade that failed and showed errors upon running this. I'm pretty sure it was a pre-exisiting condition. It would be great if the script halted if the diskutil finds errors.

Thank you!

Like
SOLVED Posted: Today at 4:56 PM by Pagigostra

I am not sure if anyone else is having this issue, but whenever I try the following or something similar to the following I get the error /Users/Shared/Install macOS Sierra.app/Contents/Resources/startosinstall: No such file or directory<br/>

/Users/Shared/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --applicationpath "/Users/Shared/Install macOS Sierra.app" --volume $1 --rebootdelay 1 --nointeraction

Anyone have any ideas?

Like