Apple - How can I identify the macOS version from the command line?
I don't know if all of this is imposed by Darwin, the manual page seems like it maybe is a Mac OS X (sic in my manual page as of Sep 2019) thing, but there is the awesome sw_vers
:
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: yadda yadda yadda
$ _
Here are some other options that you could use.
sysctl kern.version
kern.version: Darwin Kernel Version 16.7.0: Sun Jun 2 20:26:31 PDT 2019; root:xnu-3789.73.50~1/RELEASE_X86_64
sysctl kern.ostype
kern.ostype: Darwin
sysctl kern.osrelease
kern.osrelease: 16.7.0
sysctl kern.osrevision
kern.osrevision: 199506
And as an alternative to sw_vers
/usr/libexec/PlistBuddy -c "Print:ProductName" \
-c "Print:ProductVersion" \
-c "Print:ProductBuildVersion" /System/Library/CoreServices/SystemVersion.plist
Mac OS X
10.12.6
16G2128
LSB stands for "Linux Standard Base".
macOS isn't Linux, so it isn't part of the LSB project, and doesn't support LSB tools.