Print macOS operating system version.

sw_vers -productName
sw_vers -productVersion
sw_vers -buildVersion Key -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

10.0 	Cheetah     2001
10.1 	Puma 	      2001
10.2 	Jaguar 	    2002
10.3 	Panther     2003
10.4 	Tiger 	    2005
10.5 	Leopard     2007
10.6 	Snow Leopard 2009
10.7 	Lion 	      2011
10.8 	Mountain Lion 2012
10.9 	Mavericks   2013
10.10 Yosemite 	  2014
10.11 El Capitan  2015
10.12 Sierra 	    2016
10.13 High Sierra 2017
10.14 Mojave      2018


$ sw_vers -productName

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

Related macOS commands:

system_profiler SPSoftwareDataType
set - Set a shell variable = value
uname - Print the Darwin OS Kernel version / release / machine name.
unset - Remove variable or function names.

Copyright © SS64.com 1999-2019
Some rights reserved