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.
Script to retrieve 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:
1 2 3 |
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
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:
system_profiler –listDataTypes
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 |