Skip to content
Menu

Install macOS Updates Now (All or Recommended)

Installs selected macOS updates by label. Restarts are opt-in, and FORCE_RESTART can override the signed-in user check.

Install macOS updates now (all or recommended) is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Install macOS updates now (all or recommended). Tell other MSPs how it worked for you.

Write a Review

LanguageBash
Runs onmacOS 13+; runs as root
Needsbash 3.2, root, internet access to Apple; a volume owner's credentials for macOS updates on Apple silicon without MDM
Changes thingsChanges what it runs on

What It Does

The script asks Apple which updates are available with softwareupdate -l, picks the ones in UPDATE_SCOPE, and installs them by label. Recommended installs only the updates Apple marks as recommended, and All installs everything listed. A new major macOS version, for example 26 to 27, is never installed unless INCLUDE_MAJOR_UPGRADES is true, and the answer says when one was left out.

It does not restart the Mac unless RESTART is true, an update needs one, and nobody is signed in at the console. FORCE_RESTART skips the signed-in user check when RESTART is true, so a restart can close their work. Without a restart, an update that needs one is downloaded and staged, and the answer says restart needed.

On Apple silicon, installing a macOS update needs a volume owner's credentials unless the Mac has an MDM bootstrap token. Give VOLUME_OWNER_USER and the environment variable VOLUME_OWNER_PASSWORD, which should be a secret field in your RMM and is never an argument. If Apple refuses without them, the run ends in ERROR with that reason.

When the run does not request a restart, it lists updates again and ends in ERROR if a selected update that needs no restart is still offered. Updates that need a restart are excluded from that verification. It needs internet access to Apple, it relies on softwareupdate's English output, and it is slow: macOS updates download gigabytes and can take an hour.

Before You Run It

  • Run it with DRY_RUN=true first and read the list of updates it would install.
  • Put VOLUME_OWNER_PASSWORD in a secret field in your RMM, and set it as an environment variable. Never pass it as an argument.
  • Leave RESTART false until you have a maintenance window. A staged update installs at the next restart.
  • Do not set FORCE_RESTART on a Mac someone is using. It loses their unsaved work.
  • Allow time. Raise TIMEOUT_MINUTES for a big macOS update on a slow link.

Type and Risk

  • Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
  • Risk: Low. Set DRY_RUN=true to list every change without making any.
  • What it changes: Installs Apple software updates; restarts the Mac only when RESTART is true.
  • Restart: It restarts the machine itself: that is its job, or an input you set turns it on. The answer says when.
  • Typical run: 5 minutes to over an hour, depending on the updates.
  • Example answer: "Installed 2 update(s); restart needed: Safari 18.2; macOS 27.2.1"
  • Tested before listing on macOS 27 (Apple silicon VM) with /bin/bash 3.2, run as root, against its own test cases.

Inputs

Pass an input as an argument (--input-name value), as an environment variable named as listed, which is how most RMMs pass script variables, or change its default in the DEFAULT_ lines near the top of the script. An argument wins over an environment variable, which wins over the default.

  • UPDATE_SCOPE: Recommended (default) or All.
  • INCLUDE_MAJOR_UPGRADES: Also install a new major macOS version. Default false.
  • RESTART: Restart after installing if an update needs it. Default false.
  • FORCE_RESTART: Restart even if someone is signed in. Default false.
  • TIMEOUT_MINUTES: Give up on the install after N minutes. 5-720, default 90.
  • VOLUME_OWNER_USER: Apple silicon: a volume owner for macOS updates. Default none.
  • VOLUME_OWNER_PASSWORD: That user's password. Environment variable only.

Every script also takes DRY_RUN, OUTPUT_FORMAT (Text, Answer, Json or Csv), EXPORT_PATH and RESULT_FIELD, which writes the answer to an RMM custom field, unless the list above words one differently.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

install-macos-updates.sh · 706 lines · 32.2 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.