Notes

Get all kinds of information about your Mac machine using the Terminal

Edit on GitHub

System Administration
3 minutes
1# generate a System Report..
2system_profiler

This command is the command line equivalent of going to About This Mac > System Report..

You might need this if you write Bash scripts for example where you want to know if a program is installed on the system or not.

If you just run the command in the Terminal, it will start outputting all kinds of information, LOADS of it, including stuff like your machine’s UUID, available Wi-Fi networks, system diagnostic tests, details about what Applications are installed on the system and their versions, the fonts installed, hardware overview and so on..

So much information that you’ll not be able to scroll up and see everything in Terminal. A better approach is to redirect the output to a file, which we can easily view and search. I ended up with a file with more than 65000 lines

1# save the profile to a text document called system_profile.txt on the Desktop
2system_profiler > /Users/$(whoami)/Desktop/system_profile.txt

Alternatively, you can also create a file that can be opened by the System Profiler.app

1system_profiler -xml > /Users/$(whoami)/Desktop/system_profile.spx

You can open this file in the same view as System Report. The only difference is that now you have the report saved as a file (and can send the file to other people if need be, say you want tech support or something of the sort)

Find out what more you can do with the command

1man system_profiler # manual
2system_profiler -usage # quick usage info

Get specific info

You can view specific details by passing system_profiler a ‘data type’.

1# View all data types available
2system_profiler -listDataTypes
1# Some common data types
2system_profiler SPHardwareDataType # Hardware overview 
3system_profiler SPSoftwareDataType # Software overview
4system_profiler SPDisplaysDataType # Displays (type, resolution, chipset model etc.)
5system_profiler SPNetworkDataType # Network overview (Ethernet, WiFi, Bluetooth, Thunderbolt etc.)
6system_profiler SPMemoryDataType # Memory / RAM (size, type, speed etc.)
7system_profiler SPPowerDataType # Battery (cycles, capacity, charge remaining etc.) + Power settings
8system_profiler SPAirPortDataType # WiFi details (current network, available WiFi networks etc.)
9system_profiler SPStorageDataType # Storage (Hard drives, available space, capacity etc.)

Example output

 1# system_profiler SPStorageDataType
 2Storage:
 3
 4    Macintosh HD:
 5
 6      Available: 11.38 GB (11,382,779,904 bytes)
 7      Capacity: 121.12 GB (121,123,069,952 bytes)
 8      Mount Point: /
 9      File System: APFS
10      Writable: Yes
11      Ignore Ownership: No
12      BSD Name: disk1s1
13      Volume UUID: 8519CF4C-1F99-3382-89F1-DE596D69BF9E
14      Physical Drive:
15          Device Name: APPLE SSD SM0128F
16          Media Name: AppleAPFSMedia
17          Medium Type: SSD
18          Protocol: PCI
19          Internal: Yes
20          Partition Map Type: Unknown

Examples

Find out if Xcode / Developer Tools is installed

The details include version, SDKs, install location etc.

1system_profiler SPDeveloperToolsDataType
Developer:

    Developer Tools:

      Version: 9.0.1 (9A1004)
      Location: /Applications/Xcode.app
      Applications:
          Xcode: 9.0.1 (13249)
          Instruments: 9.0 (63198)
      SDKs:
          iOS:
              11.0: (15A372)
          iOS Simulator:
              11.0: (15A372)
          macOS:
              10.13: (17A360)
          tvOS:
              11.0: (15J380)
          tvOS Simulator:
              11.0: (15J380)
          watchOS:
              4.0: (15R372)
          watchOS Simulator:
              4.0: (15R372)

Find out which OS X / macOS version is installed

1system_profiler SPSoftwareDataType | grep 'System Version:'
      System Version: macOS 10.13.1 (17B48)

macOS 10.13 is High Sierra