does the software update command have --forcequitapps?

tcandela
Valued Contributor II

the macOS installers have the --forcequitapps argument, can this also be used for the softwareupdate command?

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

so if I have the 'execute command' softwareupdate -aiR --forcquitapps 

will this work for the software update command?

 

I'm testing a self service policy, with notification popup  for computers that have macOS updates pending, so during my first test on a system that needed 11.6.1 and a Safari update installed,  the computer did not restart since SELF SERVICE was open, once I quit Self Service the computer restarted and the updates installed.

So if there are multiple applications open then then obviously the  restart would still not occur, so would this --forcequitapps work at the end of the softwareupdate -aiR command?

4 REPLIES 4

Hugonaut
Valued Contributor II

@tcandelaNo, the --forcequitapps flag is explicitly for the startosinstall binary. you can run "man softwareupdate" in terminal to see all the flags. Pasted below is the man page from macOS Big Sur 11

What you are looking for is

 

                 -R | --restart
                             Automatically restart (or shut down) if required to complete installation.
                             If the user invoking this tool is logged in then macOS will attempt to quit
                             all applications, logout, and restart. If the user is not logged in, macOS
                             will trigger a forced reboot if necessary. If you wish to always perform a
                             forced reboot, pass -f (--force).

 

 

Hugonaut:~ Hugo$ man softwareupdate

                 Each update specified by args is downloaded and installed.  args can be one of the fol-
                 lowing:

                 -r | --recommended
                             All updates that are recommended for your system. These are prefixed with a
                             * character in the --list output.

                 -R | --restart
                             Automatically restart (or shut down) if required to complete installation.
                             If the user invoking this tool is logged in then macOS will attempt to quit
                             all applications, logout, and restart. If the user is not logged in, macOS
                             will trigger a forced reboot if necessary. If you wish to always perform a
                             forced reboot, pass -f (--force).

                 -a | --all  All updates that are applicable to your system, including those non-recom-
                             mended ones, which are prefixed with a - character in the --list output.
                             (Non-recommended updates are uncommon in any case.)

                 item ...    One or more specified updates. The --list output shows the item names you
                             can specify here, prefixed by the * or - characters. See EXAMPLES.

     -d | --download
                 Each update specified by args is downloaded but not installed. The values of args are
                 the same as for the --install command. Updates downloaded with --download can be subse-
                 quently installed with --install, or through the App Store (as long as they remain
                 applicable to your system).  Updates are downloaded to /Library/Updates, but are not
                 designed to be installed by double-clicking the packages in that directory: always use
                 --install or the App Store to actually perform the install.

     --schedule  Returns the per-machine automatic (background) check preference.

     -h | --help
                 Print command usage.

EXAMPLES
     The following examples are shown as given to the shell:

     softwareupdate --list

           Software Update Tool

           Finding available software
           Software Update found the following new or updated software:
              * Label: MacBookAirEFIUpdate2.4-2.4
                   Title: MacBook Air EFI Firmware Update, Version: 2.4, Size: 3817K, Recommended: YES, Action: restart,
              * Label: ProAppsQTCodecs-1.0
                   Title: ProApps QuickTime codecs, Version: 1.0, Size: 968K, Recommended: YES,
              * Label: JavaForOSX-1.0
                   Title: Java for OS X 2012-005, Version: 1.0, Size: 65288K, Recommended: YES,

     sudo softwareupdate --install JavaForOSX-1.0

           Software Update Tool

           Finding available software

           Downloading Java for OS X 2012-005
           Downloaded Java for OS X 2012-005
           Installing Java for OS X 2012-005
           Done with Java for OS X 2012-005
           Done.

     sudo softwareupdate --schedule

 

 

________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month

IamGroot
New Contributor III

You can run the below command which should do just that.

 

 

softwareupdate -iaR

 

tcandela
Valued Contributor II

@Hugonaut  @IamGroot   the command i currently use is  softwareupdate -aiR

 

does it matter if the 'a' and 'i' are in different order?  the help menu shows the 'i'  as an option, while the 'a' is an argument.   I do have the R in my command but it didn't restart because it of 'Self Service' being open.

I added to the policy the 'Restart' payload an set it to 'restart immediately' for both 'no user logged in' and 'user logged in'  and retested it with not just Self Service open but also Microsoft Word and the computer restarted.

I'm going to test the -v to see if it will show the progress of the download/installation of the updates.

so

softwareupdate -ivaR

Hugonaut
Valued Contributor II

@tcandela

 

softwareupdate -ivaRf

 If you wish to always perform a
                             forced reboot, pass -f (--force).

 

________________
Looking for a Jamf Managed Service Provider? Look no further than Rocketman
________________


Virtual MacAdmins Monthly Meetup - First Friday, Every Month