Detect MacOS version number or Processor chip

Sometimes as a developer you want to be sure that the Mac your VBA code is running on have the correct MacOS version installed so your code is working correct. With the macro example below you can test the MacOS version.

On the moment I updated this page my MacOS version (Big Sur) = 11.2.3

Mac OS X 10.0 Cheetah
Mac OS X 10.1 Puma
Mac OS X 10.2 Jaguar
Mac OS X 10.3 Panther
Mac OS X 10.4 Tiger
Mac OS X 10.5 Leopard
Mac OS X 10.6 Snow Leopard
Mac OS X 10.7 Lion
OS X 10.8 Mountain Lion
OS X 10.9 Mavericks
OS X 10.10 Yosemite
OS X 10.11 El Capitan
MacOs 10.12 Sierra
MacOs 10.13 High Sierra
MacOs 10.14 Mojave
MacOs 10.15 Catalina
MacOs 11.?.? Big Sur

In the Mac Office 2016 version they changed the string that is returned by Application.OperatingSystem so I looked for another solution that is working in Office. The macro example below I test if Catalina or higher is installed on your Mac.

Sub TestMacOSVersion()
'Example to test if Catalina or higher is installed (10.15)
Dim OSstring As String
Dim MySplit As Variant

OSstring = MacScript("do shell script ""sw_vers -productVersion""")
MySplit = Split(OSstring, ".")

If Val(MySplit(0)) = 10 And Val(MySplit(1)) = 15 Or Val(MySplit(0)) = 11 Then
MsgBox "This is macOS Catalina or higher"
MsgBox "This is Mojave or lower"
End If

' For information and testing only I add the three lines below
MsgBox MySplit(0)
MsgBox MySplit(1)
MsgBox MySplit(2)
End Sub

Processor chip

Application.OperatingSystem return a string like this : Macintosh (Intel) Version 11.2.3 (Build 20D91).
On this moment of you run the code on a Macbook with M1 chip it also say that you have an Intel chip so that is a bug. The team is aware of it and we hope they fix it. For now and also if it is fixed you can use the macro below to test if the Mac have an Intel or M1 chip. Let me know if it is not working for you.

Sub ProcessorChipInMac()
'Result = x68_64 for Intel and arm64 for M1 chip
Dim ASstring As String
Dim GetProcessorChip As String

ASstring = "set MyChipInMac to do shell script ""uname -m"""

GetProcessorChip = MacScript(ASstring)

MsgBox GetProcessorChip
End Sub
Web design by Will Woodgate