$sw_vers
ProductName: Mac OS X ProductVersion: 10.6.4 BuildVersion: 10F569 $sw_vers -productVersion
10.6.4
Especially handy when resetting a password in single user mode, since the method varies based on which version of OS X is running.
Here's another way to check; great for use on offline OS X installs:
$ grep -2 ProductVersion /Volumes/OfflineVolumeName/System/Library/CoreServices/SystemVersion.plist
<key>ProductUserVisibleVersion</key>
<string>10.11.6</string>
<key>ProductVersion</key>
<string>10.11.6</string>
system_profiler SPHardwareDataType | awk '/Serial/ {print $4}'
sysctl -n hw.model
system_profiler
can query all sorts of hardware information, e.g., system_profiler SPSerialATADataType | grep "Medium"
to check whether the internal drive is Rotational or Solid State. Run system_profiler -listDataTypes
to list the available datatypes; see Get OS X System Info from the Command Line for more information.
In Linux, find model identifier and serial number via dmidecode -t system
.
Under macOS 10.12 Sierra or higher, retrieve serial number via ioreg -l | grep IOPlatformSerialNumber
.
/mac | Aug 14, 2010