sw_vers

Print macOS operating system version.

Syntax
      sw_vers
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: macOS
ProductVersion: 10.12
BuildVersion: 7A100

The ProductName property provides the name of the operating system release (typically either "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.

Example

$ sw_vers -productName

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

Related:

set - Set a shell variable = value
unset - Remove variable or function names


Copyright © SS64.com 1999-2017
Some rights reserved