Big Sur Current Version?

agetz
Contributor

I'm trying to get the most current version of Big Sur so I can add it to an installer script. Basically just checking if the user has the most current version of the installer before it runs.

I have this so far but I am a noob at awk and grep commands.

#!/bin/sh
    latestver=`curl -s http://itunes.apple.com/lookup?bundleId=com.apple.InstallAssistant.macOSBigSur&country=US  | awk -F':' '/"com.apple.InstallAssistant.macOSBigSur", "version"/{print $3; exit}'`
    echo "Latest Version is: $latestver"

I'm trying to get the 11.2.2 value into the latestver string. Any help would be much appreciated. Also, if anyone has a better way of getting the most current version number, I'm all ears. Thanks.

1 ACCEPTED SOLUTION

skeenan07
New Contributor III

This uses Jamf's patch URL to get the current version of Big Sur.

#!/bin/sh
latestver=$(curl -s "https://jamf-patch.jamfcloud.com/v1/software/303" | grep currentVersion | tr -d '"' | awk '{ print $2 }')
echo "Latest Version is: $latestver"

View solution in original post

3 REPLIES 3

skeenan07
New Contributor III

This uses Jamf's patch URL to get the current version of Big Sur.

#!/bin/sh
latestver=$(curl -s "https://jamf-patch.jamfcloud.com/v1/software/303" | grep currentVersion | tr -d '"' | awk '{ print $2 }')
echo "Latest Version is: $latestver"

cbrewer
Valued Contributor II

Your curl command is returning JSON. You could use jq to work with the JSON. The only problem is that jq isn't included in macOS.

curl -s "http://itunes.apple.com/lookup?bundleId=com.apple.InstallAssistant.macOSBigSur&country=US" | jq -r ".results[].version"

agetz
Contributor

I'm definitely using that patch URL again. That makes it much easier. Thanks @skeenan07 !