Merge pull request #32 from HowardGMac/master

Update Get-LatestOSSupported.sh adding support for macOS Tahoe
This commit is contained in:
Zack T
2025-10-03 14:45:37 -07:00
committed by GitHub

View File

@@ -4,7 +4,7 @@
#################################################################################################### ####################################################################################################
# Script Name: Get-LatestOSSupported.sh # Script Name: Get-LatestOSSupported.sh
# By: Zack Thompson / Created: 9/26/2017 # By: Zack Thompson / Created: 9/26/2017
# Version: 2.6.1 / Updated: 6/11/2024 / By: ZT # Version: 2.7.0 / Updated: 6/11/2025 / By: @HowardGMac
# #
# Description: A Jamf Pro Extension Attribute to check the latest compatible version of macOS. # Description: A Jamf Pro Extension Attribute to check the latest compatible version of macOS.
# #
@@ -22,7 +22,8 @@
# updated. # updated.
# #
# System Requirements can be found here: # System Requirements can be found here:
# Sequoia (Preview) - https://www.apple.com/macos/macos-sequoia-preview/ # Tahoe - https://support.apple.com/en-us/122867
# Sequoia - https://support.apple.com/en-us/120282
# Sonoma - https://support.apple.com/en-us/105113 # Sonoma - https://support.apple.com/en-us/105113
# Ventura - https://support.apple.com/en-us/102861 # Ventura - https://support.apple.com/en-us/102861
# * Apple has never publicly posted storage requirements for Ventura, which is why this # * Apple has never publicly posted storage requirements for Ventura, which is why this
@@ -77,6 +78,7 @@ not_monterey_regex="^(MacPro[1-5],[0-9]|iMac([1-9]|1[0-5]),[0-9]|(Macmini|MacBoo
not_ventura_regex="^(MacPro[1-6],[0-9]|iMac([1-9]|1[0-7]),[0-9]|(Macmini|MacBookAir)[1-7],[0-9]|MacBook[1-9],[0-9]|MacBookPro([1-9]|1[0-3]),[0-9])$" not_ventura_regex="^(MacPro[1-6],[0-9]|iMac([1-9]|1[0-7]),[0-9]|(Macmini|MacBookAir)[1-7],[0-9]|MacBook[1-9],[0-9]|MacBookPro([1-9]|1[0-3]),[0-9])$"
not_sonoma_regex="^(MacPro[1-6],[0-9]|iMac([1-9]|1[0-8]),[0-9]|(Macmini|MacBookAir)[1-7],[0-9]|MacBook[0-9,]+|MacBookPro([1-9]|1[0-4]),[0-9])$" not_sonoma_regex="^(MacPro[1-6],[0-9]|iMac([1-9]|1[0-8]),[0-9]|(Macmini|MacBookAir)[1-7],[0-9]|MacBook[0-9,]+|MacBookPro([1-9]|1[0-4]),[0-9])$"
not_sequoia_regex="^(MacPro[1-6],[0-9]|iMac([1-9]|1[0-8]),[0-9]|Macmini[1-7],[0-9]|MacBookAir[1-8],[0-9]|MacBookPro([1-9]|1[0-4]),[0-9])$" not_sequoia_regex="^(MacPro[1-6],[0-9]|iMac([1-9]|1[0-8]),[0-9]|Macmini[1-7],[0-9]|MacBookAir[1-8],[0-9]|MacBookPro([1-9]|1[0-4]),[0-9])$"
not_tahoe_regex="^(MacPro[1-6],[0-9]|iMac([1-9]|1[0-9]),[0-9]|iMacPro1,1|Macmini[1-8],[0-9]|MacBookAir[1-9],[0-9]|MacBookPro((16,3)|([1-9]|1[0-5]),[0-9]))$"
################################################## ##################################################
# Setup Functions # Setup Functions
@@ -121,8 +123,10 @@ model_check() {
echo "Ventura*" echo "Ventura*"
elif [[ $model =~ $not_sequoia_regex ]]; then elif [[ $model =~ $not_sequoia_regex ]]; then
echo "Sonoma*" echo "Sonoma*"
else elif [[ $model =~ $not_tahoe_regex ]]; then
echo "Sequoia*" echo "Sequoia*"
else
echo "Tahoe*"
fi fi
} }
@@ -141,6 +145,11 @@ os_check() {
# For all models except MacPro5,1... # For all models except MacPro5,1...
if [[ if [[
"${validate_os}" == "Tahoe*" && \
( "${os_major}" -ge 11 || "${os_major}" -eq 10 && "${os_minor}" -ge 9 )
]]; then
echo "Tahoe*"
elif [[
"${validate_os}" == "Sequoia*" && \ "${validate_os}" == "Sequoia*" && \
( "${os_major}" -ge 11 || "${os_major}" -eq 10 && "${os_minor}" -ge 9 ) ( "${os_major}" -ge 11 || "${os_major}" -eq 10 && "${os_minor}" -ge 9 )
]]; then ]]; then
@@ -261,7 +270,7 @@ ram_check() {
system_ram=$(( $( /usr/sbin/sysctl -n hw.memsize ) / bytes_in_gigabytes )) system_ram=$(( $( /usr/sbin/sysctl -n hw.memsize ) / bytes_in_gigabytes ))
if [[ if [[
"${validate_os}" =~ ^(Catalina|Big[[:space:]]Sur|Monterey|(Ventura|Sonoma|Sequoia)\*)$ "${validate_os}" =~ ^(Catalina|Big[[:space:]]Sur|Monterey|(Ventura|Sonoma|Sequoia|Tahoe)\*)$
]]; then ]]; then
# OS version requires 4GB RAM minimum. For Ventura and newer, value's are inherited from # OS version requires 4GB RAM minimum. For Ventura and newer, value's are inherited from
# Monterey as Apple has not publicly defined these requirements. # Monterey as Apple has not publicly defined these requirements.
@@ -351,6 +360,13 @@ storage_check() {
# Set the required free space to compare. # Set the required free space to compare.
# Set space requirement in bytes: /usr/bin/bc <<< "<space in GB> * 1073741824" # Set space requirement in bytes: /usr/bin/bc <<< "<space in GB> * 1073741824"
case "${validate_os}" in case "${validate_os}" in
"Tahoe*"* )
# Value's inherited from Monterey, Apple has not defined these requirements
required_free_space_newer="27917287424" # 26GB if Sierra or later
os_newer="10.12.0"
required_free_space_older="47244640256" # 44GB if El Capitan or earlier
os_older="10.11.0"
;;
"Sequoia*"* ) "Sequoia*"* )
# Value's inherited from Monterey, Apple has not defined these requirements # Value's inherited from Monterey, Apple has not defined these requirements
required_free_space_newer="27917287424" # 26GB if Sierra or later required_free_space_newer="27917287424" # 26GB if Sierra or later
@@ -462,6 +478,9 @@ fi
model_result=$( model_check "${mac_model}" ) model_result=$( model_check "${mac_model}" )
case "${model_result}" in case "${model_result}" in
"Tahoe*" )
version_string="26"
;;
"Sequoia*" ) "Sequoia*" )
version_string="15" version_string="15"
;; ;;
@@ -522,4 +541,4 @@ fi
echo "<result>${report_result}</result>" echo "<result>${report_result}</result>"
write_to_ea_history "latest_os_supported" "${model_result}" write_to_ea_history "latest_os_supported" "${model_result}"
exit 0 exit 0