sw_vers --productName | --productVersion | --productVersionExtra| --buildVersionOutputs macOS version information for the currently running operating system on the local machine.
With no options putputs a short list of version properties:
% sw_vers
ProductName: macOS
ProductVersion: 13.0
ProductVersionExtra: (a)
BuildVersion: 22A100
The ProductName property provides the name of the operating system release (typically "macOS"). --productName
|
% sw_vers --productName
macOS
% sw_vers --productVersion
13.0
% sw_vers --productVersionExtra
(a)
% sw_vers --buildVersion
22A100
$SYSTEM_VERSION_COMPAT to provide compatibility fallback versions for
scripts which did not support the macOS 11.0+
/System/Library/CoreServices/SystemVersion.plist
From plist:
BuildID E11C21BE-8D1C-11EF-8CD4-7C85970E9FD2
ProductBuildVersion 24B82
ProductCopyright 1983-2024 Apple Inc.
ProductName macOS
ProductUserVisibleVersion 15.1
ProductVersion 15.1
iOSSupportVersion 18.1
?
macOS 15.1 October 27, 2022