When you click on About This Mac and then click on More Info… you see the Apple System Profiler. This tool, dating back to the Classic OS (prehistory so-to-speak) can be used to access a wide variety of information about your system, including installed hardware, software and some settings. Some of this information can also be obtained through other tools. For example, the networksetup command can obtain a wide variety of information about various network settings. But it helps to have one tool to query for any information you may need about a computer (well, much of the information you may need).
While it is fairly straight forward to sit down and and open Apple System Profiler and look for information, this can be fairly tedious to do en masse. Luckily, there is a command line version of the Apple System Profiler, aptly named system_profiler. This command can be used to view any of the information from the Apple System Profiler, which you can then parse and use in scripts in a variety of ways. This allows you to, for example, go far beyond what Apple Remote Desktop can provide in terms of reports and even write relevant information from systems into an out-of-band database, common in enterprise environments looking to centralize asset management for Macs into an existing Windows or Linux solution.
Using the system_profiler command is fairly straight forward. If you just run system_profiler then it will show you far more information than you can likely use. Essentially, every field from Apple System Profiler will be displayed, including installed Frameworks, Fonts, Extensions, etc. Therefore, a healthy dose of grep can help immensely. But what do you grep for? Well, find a field in Apple System Profiler and note the section it’s in under the Contents column of the application. Then, run the following command:
system_profiler -listdatatypes
You should see an output similar to the following (notice the similarity with the items from the GUI):
SPHardwareDataType
SPNetworkDataType
SPSoftwareDataType
SPParallelATADataType
SPAudioDataType
SPBluetoothDataType
SPDiagnosticsDataType
SPDiscBurningDataType
SPFibreChannelDataType
SPFireWireDataType
SPDisplaysDataType
SPHardwareRAIDDataType
SPMemoryDataType
SPPCCardDataType
SPPCIDataType
SPParallelSCSIDataType
SPPowerDataType
SPPrintersDataType
SPSASDataType
SPSerialATADataType
SPUSBDataType
SPAirPortDataType
SPFirewallDataType
SPNetworkLocationDataType
SPModemDataType
SPNetworkVolumeDataType
SPApplicationsDataType
SPExtensionsDataType
SPFontsDataType
SPFrameworksDataType
SPLogsDataType
SPManagedClientDataType
SPPrefPaneDataType
SPStartupItemDataType
SPUniversalAccessDataType
system_profiler SPPrefPaneDataType | grep 3rd
system_profiler SPSoftwareDataType | grep “Computer Name”; system_profiler SPPrefPaneDataType | grep Flip4Mac
With regular expressions we can actually get really detailed information out of system_profiler and then normalize the data for inclusion into our database; perhaps adding a , for a delimiter, etc.