Print macOS operating system version.

      sw_vers -productName
      sw_vers -productVersion
      sw_vers -buildVersion

   -productName     Print just the value of the ProductName property.

   -productVersion  Print just the value of the ProductVersion property.

   -buildVersion    Print just the value of the BuildVersion property.

When executed with no options sw_vers prints a short list of version properties:

% sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G1815

The ProductName property provides the name of the operating system release (typically either "Mac OS X", "macOS" or "macOS Server"). The ProductVersion property defines the version of the operating system release (for example, "10.2.4" or "10.3"). The BuildVersion property provides the specific revision of the operating system as generated by the macOS build system.

macOS versions

Major versions of macOS are released once a year, and are usually maintained for three years.
macOS Release Notes

13    Ventura     2022
12    Monterey    2021
11    Big Sur     2020  (may appear as 10.16)
10.15 Catalina    2019
10.14 Mojave      2018  last 32-bit support
10.13 High Sierra 2017
10.12 Sierra      2016
10.11 El Capitan  2015
10.10 Yosemite    2014
10.9  Mavericks   2013
10.8  Mountain Lion 2012
10.7  Lion        2011
10.6  Snow Leopard 2009
10.5  Leopard     2007
10.4  Tiger       2005  first 64-bit support
10.3  Panther     2003
10.2  Jaguar      2002
10.1  Puma        2001
10.0  Cheetah     2001


$ sw_vers -productVersion

"Have no friends not equal to yourself" ~ Confucious (Analects)

Related macOS commands

system_profiler SPSoftwareDataType
set - Set a shell variable = value
softwareupdate - Check for new and updated software or Download a full macOS installer.
How-to:Make a bootable macOS drive
How-to: macOS versions.
uname - Print the Darwin OS Kernel version / release / machine name.
unset - Remove variable or function names.

Copyright © 1999-2024 SS64.com
Some rights reserved