If you have experience with the Unix command line, or would like to use readings in your own scripts, this will be possible. You can use a version of the monitor application that comes without a graphical user interface. The executable binary can be found in the application bundle. To launch it, use the following relative path:
The synopsis is as follows:
hwmonitor [-c | -f | -k] [-ds] [-q] [-th | -tv]
The program will display the current readings of all available sensors using a line
sensor-name: value unit
for each sensor. Sensor names are the location identifiers used internally by Hardware Monitor. If you specify the -c, -f or -k options, you’ll force the program to return the value in degrees Celsius, Fahrenheit or Kelvin, respectively.
Sensors which have been detected but are offline, for example because they are part of a device currently in sleep mode, or because they currently experience a technical problem, are shown with a value of “-” (a single minus sign).
If you add the option -ds, access to S.M.A.R.T. hard drive sensors will be disabled. This can be useful when using the program periodically in a continuously running script, making sure disk drives are not kept busy, allowing them to enter sleep mode.
When adding the option -q, quantity descriptions will be appended at the end of each sensor location label. This helps to differentiate between sensors on specific hardware models where multiple quantities (e.g. voltage, current, and power) are being measured at the same location. The quantity is specified between square brackets. This is an example:
SMC MEMORY VRM SUPPLY A [VOLTAGE]: 1.52344 V SMC MEMORY VRM SUPPLY A [CURRENT]: 1.23828 A SMC MEMORY VRM SUPPLY A [POWER]: 1.89062 W
The command-line program uses the following identifiers for the different quantities:
|RPMS||revolutions per minute|
|PULSE WIDTH||duty cycle of pulse-width modulation in percent|
|LIGHT||photometric value for incoming light|
|LOAD||load in percent|
|MEMORY SIZE||memory size|
|STATUS||logical status (0= no / 1 = yes)|
|DISCONNECTED||sensor is currently offline|
The options with the first letter “t” can be used to generate a table in CSV format (Comma-Separated Values). CSV is an industry standard which allows you to import data into nearly any database and spreadsheet applications.
The option -th generates a table header line which lists all sensor names. The option -tv generates a value line for the table, listing all current readouts as specified by the header line, omitting units. The first column of the table contains date and time formatted in compliance with international ISO standards.
Similar to the main application, hwmonitor needs a license key to run in unrestricted mode, showing all sensors, not only temperature readings. The command-line version automatically uses the key of the main application after it has been entered. It is recommended to unlock the application with the option Activate for: All users of this computer.
In case of problems, the commands will send error messages to the standard error channel. Upon return, the programs use the following exit codes:
The following script shows a very simple example how to use the command line version of Hardware Monitor to record all values of all sensors with a time resolution of one minute in a CSV database file. With this technique, you can overcome Hardware Monitor’s limit for long-time histories of one week, creating an “unlimited” history file. Note that this solution is very simplistic, and is shown only to outline the basic principles. The script must be customized to your specific needs, and should be more elegant in practice. For example, it should not just erase the whole history file when the script is stopped and then restarted.
#!/bin/sh cd /ExamplePath/HardwareMonitor.app/Contents/MacOS/ ./hwmonitor -th > /Some/Document/Path/HistoryData.csv while true do ./hwmonitor -tv >> /Some/Document/Path/HistoryData.csv /bin/sleep 60 done