

For example: if ] thenĮcho "OS Version is macOS Big Sur 11.0.1 or newer, proceeding."Įcho "OS Version is macOS Big Sur 11.0.0 or older this script will not work. Exiting."Īnother cool thing we can do is to use string comparisons 2 to further compare minor versions without having to convert letters to numbers. For example: if ] thenĮcho "OS Version is macOS Big Sur 11.0 or newer, proceeding."Įcho "OS Version is macOS Catalina 10.15 or older this script will not work. Understanding this, we can then create comparisons between the minor versions, without having to “nest” comparisons. This changes slightly with macOS Big Sur: macOS Product Version
Apple macos versions in order mac os x#
usr/bin/sw_vers -buildVersion | cut -c1-2Īt a glance, these numbers and letters may not seem intuitive, however they track directly with the minor and patch versions in Apple’s versioning scheme, and they have done, going back as far as Mac OS X Mountain Lion ( Mac OS X Lion skipped F in the patch version), for example: macOS Product VersionĪs you can see, 10.15 tracks to 19, and the minor version tracks to A though H, with A being 0 and H being 7. For example, on macOS Catalina (10.15.7): New hotnessĪn alternative method of comparing minor and patch versions of macOS would be to use the build number in place of the product version.

Apple macos versions in order code#
… adding in the comparison of patch versions to the above code only serves to further complicate matters. '') -ge 15 ]] thenĮcho "OS Version is macOS Catalina 10.15 or newer, proceeding."Įcho "OS Version is macOS Mojave 10.14 or older this script will not work. usr/bin/sw_vers -productVersion | awk -F. This is typically obtained using the sw_vers binary. the minor version of macOS Catalina 10.15.7 is 15) and using these in comparison functions. This typically involves splitting apart the product version into “Major”, “Minor” and “Patch” numbers (i.e. 10.15.7) of macOS to perform version comparisons within bash scripts. Up until now, we’ve been using the “Product Version” (i.e.
