| SW_VERS(1) | General Commands Manual | SW_VERS(1) |
sw_vers — print
macOS system version information
sw_vers |
sw_vers |
--productName |
sw_vers |
--productVersion |
sw_vers |
--productVersionExtra |
sw_vers |
--buildVersion |
sw_vers prints macOS version information
for the currently running operating system on the local machine.
When executed with no options sw_vers
prints 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"). The ProductVersion property defines the version of the operating system release (for example, "11.3" or "12.0"). The ProductVersionExtra property defines the Rapid Security Response version, if one is installed on the operating system (for example, "(a)" or "(b)"). The BuildVersion property provides the specific revision of the operating system as generated by the macOS build system.
The output of sw_vers can be refined by
the following options. These long-form options can also be passed in
lowercase for convenience.
--productName--productVersion--productVersionExtra--buildVersion% sw_vers --productName macOS
% sw_vers --productVersion 13.0
% sw_vers --productVersionExtra (a)
% sw_vers --buildVersion 22A100
Previous versions of sw_vers respected the
SYSTEM_VERSION_COMPAT environment variable to provide
compatibility fallback versions for scripts which did not support the macOS
11.0+ version transition. This is no longer supported, versions returned by
sw_vers will always reflect the real system
version.
sw_vers is backwards compatible with
previous versions which expect options passed with a single dash, as in:
| May 3, 2021 | Mac OS X |