Category filter
Script to retrieve System Information on Mac
The System Information app is the information hub where all the detailed specifications and information regarding a macOS device can be viewed. As a system admin, there may occur situations where you need to gather necessary information about your Mac endpoints from the System Information app. Using Hexnode’s Execute Custom Script action, you can remotely retrieve all the required information using the shell command detailed in this document.
Retrieve Mac’s System Information
1 |
system_profiler |
The system_profiler command will create a complete report of the Mac’s System Information. After successfully executing the above command, you can view the system report by navigating to Action History on the device summary page and clicking Show Output.
If you need only the information about specific system hardware or software, running the system_profiler command alone would not be very efficient as it can be time-consuming, especially if the device is slow or has an older OS version. Instead, you can run a more specific command by specifying the required Data Type.
To get a list of all the available data types associated with a Mac, you can invoke the listDataTypes argument along with the system_profiler command:
1 |
system_profiler –listDataTypes |
You can then specify the required Data Type in the Arguments space when running the following command from the Hexnode portal:
1 2 |
system_profiler $1 #the argument $1 can take the value of any Data Type |
For example, to get information about the audio devices associated with a Mac, SPAudioDataType
can be entered as the argument while executing the script from the Hexnode portal. Alternatively, you can run the following command directly:
system_profiler SPAudioDataType
Below are a few arguments that you can use to fetch specific information about the Mac:
Argument | Retrieved Information |
---|---|
SPHardwareDataType | Hardware overview |
SPSoftwareDataType | System software information |
SPBluetoothDataType | Bluetooth devices associated with the Mac |
SPUSBDataType | List all USB devices associated with the Mac |
SPDisplaysDataType | Graphics card (GPU) information |
SPStorageDataType | Information about the Mac’s storage drives |
SPPrefPaneDataType | Information about the different System Preferences panes |
Script to save the System Information report
To save the system information report in a text-based file on your Mac endpoint, run the below command.
1 |
system_profiler > enter_the_path_here/report_name.txt |