There may be occasions when one wants to verify what OS X (or macOS) version is running on a Mac. We all know how to do it from the GUI with “About This Mac,” but here’s how to do it from the UNIX command line when necessary.
First, as a reminder, one can display which version of OS X (or macOS) is installed on a Mac from the menu bar with Apple > About This Mac. That’s the standard GUI method.
A neat trick there is to click on the actual version number (in this case 10.11.6), to reveal Apple’s more exact internal nomenclature (15G31), as I did above.
However, there may be times when it’s desirable to get a more direct statement from the OS. I had this happen recently when an OS upgrade went terribly wrong. I suspected that the GUI wasn’t being truthful about the final, upgraded version that resulted. So I verified on the command line.
Another reason to use the command line is if one is remotely logged onto a Mac with, say, SSH and there’s no access to the GUI. But there’s a need to know which version of OS X (macOS) is running on that distant Mac.
Here’s the way to do it.
- Launch the Terminal app found in /Applications/Utilities
- Enter this command: sw_vers and hit return.
The output will look like this:
Because this command showed “Mac OS X” instead of “OS X,” I checked to see what it would show on a Mac with a Beta of macOS Sierra. Here’s what I got.
The enduring reference to “Mac OS X” is fascinating. Perhaps Apple, internally, has always thought of and labelled its BSD UNIX-based Mac operating system as “Mac OS X” in this layer. Perhaps some GUI parsing code needs a predictable string. Or perhaps it’s just a bookkeeping oversight.
It’s always interesting to see what’s going on from the command line!
One thought on “How to Display the macOS/OS X Version From the Command Line”
You can always look into the file /System/Library/CoreServices/SystemVersion.plist to see where the information comes from!! 🙂