Getting macOS version and system details from the command line

Tags mac

Summary

How to obtain the version, build number, current operating system, or other system details from Terminal or an SSH session.

Environment

macOS

Directions

To obtain the software version, run the command: sw_vers

The command outputs 3 lines: ProductName, ProductVersion, and BuildVersion. If you wish to get just one of them, you can use one of these:
  • sw_vers -productName
  • sw_vers -productVersion
  • sw_vers -buildVersion

For example:

bash-3.2$ sw_vers
ProductName:    macOS
ProductVersion: 13.2.1
BuildVersion:   2268D

You can view an extended list of system details with the command:system_profiler SPHardwareDataType

For example:

 Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro15,1
      Processor Name: 6-Core Intel Core i7
      Processor Speed: 2.6 GHz
      Number of Processors: 1
      Total Number of Cores: 6
      L2 Cache (per Core): 256 KB
      L3 Cache: 12 MB
      Hyper-Threading Technology: Enabled
      Memory: 16 GB
      System Firmware Version: 1916.80.2.0.0 (iBridge: 20.16.3045.0.0,0)
      OS Loader Version: 564.40.4~66
      Serial Number (system): C02ZD1SELVDT
      Hardware UUID: F6C595A0-4E72-5BD7-86A6-F6329B928252
      Provisioning UDID: F6C595A0-4E72-5BD7-86A6-F6329B928252
      Activation Lock Status: Disabled

 

There are also sub commands for this command that you can use as well:

  • Command usage — system_profiler -usage
  • Find detail options — system_profiler -listDataTypes:
    • Memory — system_profiler SPMemoryDataType
    • Network — system_profiler SPNetworkDataType
    • Hard Drives — system_profiler SPStorageDataType

Details

Article ID: 1484
Created
Tue 5/26/20 6:00 PM
Modified
Fri 3/8/24 11:44 AM