macOS installer script not working for Apple Silicon M1 Macbook + macOS Monterey

Bernard_Huang
Contributor III

Hi all,

  Referring to this macOS installer script.

macOSUpgrade/macOSUpgrade.sh at master · kc9wwh/macOSUpgrade · GitHub

  This script works fine for Intel Macbook upgrading to macOS Monterey 12.0.1.

  But it does not work with Apple Silicon Macbook 😞

  When attempting, I get the following error:

Expand
Error: failed to authorize for installation. Provide a password with --stdinpass or --passprompt.
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.

Investigating further, I run the following in a M1 Mabook's terminal.

Expand

/Applications/Install\ macOS\ Monterey.app/Contents/Resources/startosinstall --agreetolicense --nointeraction --forcequitapps
Error: A method of password entry is required.
Usage: startosinstall

.....

The error suggests I need to supply admin username and password via 
--user, an admin user to authorize installation.
--passprompt, collect a password for authorization with an interactive prompt.
--stdinpass, collect a password from stdin without interaction.

 

I want JAMF to execute this. I DO NOT want to need to supply admin account and password.

Anyone got any suggestions?

3 ACCEPTED SOLUTIONS

oit-jamf
New Contributor II

Hi there,

I managed to get the upgrade to Monterey running on an M1 macbook via Self Service with the help of a script from https://github.com/therealmacjeezy/Scripts/tree/master/macOS%2010.14%20Update%20Script, it was originally created for upgrading to Mojave but I made some adaptations to get it running for Monterey.

You will need to create the installer package and have it within the self service policy, the install macOS Monterey.app has to be available for the script to work.  Got it here: https://scriptingosx.com/2021/10/download-full-installer-update/

Most important - the logged in user has to have a secure token. This user does not necessarily have to be an admin.

this is the main key that triggers upgrade.

echo $fvPass | ./startosinstall --agreetolicense --forcequitapps --nointeraction --user $currUser --stdinpass

View solution in original post

Actually I wasn't patient enough. Works like a charm!

View solution in original post

 

Latest version working on both M1 and Intel macs

 

#!/bin/bash


# Pulls the current logged in user and their UID
currUser=$(ls -l /dev/console | awk '{print $3}')
currUserUID=$(id -u "$currUser")

fvPass=$(
# Prompts the user to input their FileVault password using Applescript. This password is used for a SecureToken into the startosinstall.
/bin/launchctl asuser "$currUserUID" sudo -iu "$currUser" /usr/bin/osascript <<APPLESCRIPT
set validatedPass to false
repeat while (validatedPass = false)
	-- Prompt the user to enter their filevault password
	display dialog "Enter your macOS password to start the macOS upgrade" with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:FileVaultIcon.icns" default answer "" buttons {"Continue"} default button "Continue" with text and hidden answer
	set fvPass to (text returned of result)
	display dialog "Re-enter your macOS password to verify it was entered correctly" buttons {"Continue"} with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:FileVaultIcon.icns" default answer "" default button "Continue" with text and hidden answer
	if text returned of result is equal to fvPass then
		set validatedPass to true
		fvPass
	else
		display dialog "The passwords you have entered do not match. Please enter matching passwords." with title "FileVault Password Validation Failed" buttons {"Re-Enter Password"} default button "Re-Enter Password" with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:FileVaultIcon.icns"
	end if
end repeat
AppleScript
)
##Heading to be used for jamfHelper

heading="Please wait as we prepare your computer for macOS Monterey..."

##Title to be used for jamfHelper

description="

This process will take approximately 20-30 minutes.

Once completed your computer will reboot and begin the upgrade which can take an additional 15-20 minutes."

##Icon to be used for jamfHelper

icon=/Applications/Install\ macOS\ Monterey.app/Contents/Resources/InstallAssistant.icns

##Launch jamfHelper

/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -title "" -icon "$icon" -heading "$heading" -description "$description" &

jamfHelperPID=$!

##Start macOS Upgrade

echo $fvPass | /Applications/Install\ macOS\ Monterey.app/Contents/Resources/startosinstall --agreetolicense --forcequitapps --nointeraction --user $currUser --stdinpass --pidtosignal $jamfHelperPID >> /var/log/startosinstall.log 2>&1 &

exit 0

 

 

edited to include the fix from @benjmars 

 

 

View solution in original post

132 REPLIES 132

virtasupport
New Contributor II

My initial tests are failing on a M1 MBA running Big Sur with the full Monterey installer present. Get the helper screen for eternity. Never completes the process.

MatthewHegge
New Contributor II

This simply is not working with Big Sur M1's with FileVault enabled:

 

#!/bin/bash


# Pulls the current logged in user and their UID
currUser=$(ls -l /dev/console | awk '{print $3}')
currUserUID=$(id -u "$currUser")

fvPass=$(
# Prompts the user to input their FileVault password using Applescript. This password is used for a SecureToken into the startosinstall.
/bin/launchctl asuser "$currUserUID" sudo -iu "$currUser" /usr/bin/osascript <<APPLESCRIPT
set validatedPass to false
repeat while (validatedPass = false)
-- Prompt the user to enter their filevault password
display dialog "Enter your macOS password to start the macOS upgrade" with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:FileVaultIcon.icns" default answer "" buttons {"Continue"} default button "Continue" with text and hidden answer
set fvPass to (text returned of result)
display dialog "Re-enter your macOS password to verify it was entered correctly" buttons {"Continue"} with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:FileVaultIcon.icns" default answer "" default button "Continue" with text and hidden answer
if text returned of result is equal to fvPass then
set validatedPass to true
fvPass
else
display dialog "The passwords you have entered do not match. Please enter matching passwords." with title "FileVault Password Validation Failed" buttons {"Re-Enter Password"} default button "Re-Enter Password" with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:FileVaultIcon.icns"
end if
end repeat
AppleScript
)
##Heading to be used for jamfHelper

heading="Please wait as we prepare your computer for macOS Monterey. Keep plugged in. Do not close lid..."

##Title to be used for jamfHelper

description="

This process will take approximately 20-30 minutes.

Once completed your computer will reboot and begin the upgrade which can take an additional 20-30 minutes."

##Icon to be used for jamfHelper

icon=/Applications/Install\ macOS\ Monterey.app/Contents/Resources/InstallAssistant.icns

##Launch jamfHelper

/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -title "" -icon "$icon" -heading "$heading" -description "$description" &

jamfHelperPID=$!

##Start macOS Upgrade

echo $fvPass | /Applications/Install\ macOS\ Monterey.app/Contents/Resources/startosinstall --agreetolicense --forcequitapps --nointeraction --user $currUser --stdinpass --pidtosignal $jamfHelperPID >> /var/log/startosinstall.log 2>&1 &

kmathern
New Contributor III

I'm getting following error in /var/log/startosinstall.log while trying to upgrade an M1 pro 16" macbook.

Error: could not get authorization...

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

dvasquez
Valued Contributor

I would test and use this process:  https://github.com/grahampugh/erase-install 

It is really robust and deployable but I would test it for your environment. 

Thank you.

kmathern
New Contributor III

Thanks, I will definitely start testing that.  The process I was testing just worked without me doing anything.  It doesn't seem to be 100% working so having another process is great.  Thanks again I'll give that one a shot.

Mentioned this above too. It’s the only proven solution that I’ve made work, and it’s very intuitive and a time-saver.

SMR1
Contributor III

I downloaded 12.6.1 from the link below and have it installed to the /Application folder. When it runs, it errors out pretty quick with the below error message. I'm looking for other options to deploy 12.6.1, because I'm having issues with the erase-install.sh installing correctly on users devices.

https://scriptingosx.com/2021/10/download-full-installer-update/

 

 

Error:

Script result: 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:

Preparing: 32.6% Failed to download required installer asset (SFR).

rcole
Contributor II
Consider adjusting your parameter values under Policies > Scripts for this script.

tjhall
Contributor III

I've used this script successfully in the past with Monterey but having issues with Ventura. The MacOS Ventura installer is present on the Mac and it's starts ok but then never quits (as in reboots to install the actually update).

Anyone else come across this?

DodsonNY
New Contributor II

I've been using it with Ventura, but I have had occasional instances that sound like what you describe (on both Monterey and Ventura).  In our environment, it seems it's tied to high uptime, so I'm just asking everyone to restart before they run the script.  Haven't had time yet, but I'm also going to play with adding kickstart to this script or maybe even running a "pre" install script that runs kickstart and clears the update plist...it's cumbersome, though.  

Thanks for letting me know. I will try to restart first and see how it behaves.

szultzie
Contributor II

So i know this post is about a year old, but im trying to use this scrip on an Appel Silicon laptop, and it just gets stuck on the Jamf Helper screen saying to wait.

The password prompt worked fine no issues, but then it just sits here, Jamf policy says it completed, i have it download the Ventura Installer first and put it into the Applications folder, i know that worked because the Ventura icon is showing on the helper screen. then run this script and nothing it has been over 1 hour now since the installer downloaded.

How are you guys initiating this script with a policy?

DodsonNY
New Contributor II

AtillaTheC is my hero for this base script - it was a life saver.  I've been using it for a while with great success.  Recently I made some modifications to address some of the more common issues we were seeing with it hanging on that screen.  

My updated logic checks the password against the Keychain (instead of just verifying that the same password was entered twice), checks for sufficient available storage, checks uptime (won't proceed if the machine hasn't been restarted in [choose the number] of days, make sure the installer is in place in the /Applications directory (I run a separate policy to cache the installer first so that the update takes less time for the end users), and verifies power is connected...all that really helped with consistency for us. 

There is the fact also that JamfHelper is inherently glitchy in full screen mode, so you can either set it to not run in full screen, or if it hangs, just Command + Q to quit out of JamfHelper and the installer, from my observations, usually finishes fairly soon after.  

Also been trying to find time to swap from JamfHelper calls to using swiftDialog, which I think would be more reliable.