![]() ![]() |
Using the command-line version |
If you have experience with the BSD command line, or would like to use readings in your own scripts, this is 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 paths:
Hardware Monitor.app/Contents/MacOS/hwmonitor
, or respectively,
Temperature Monitor.app/Contents/MacOS/tempmonitor
Note: In order to fully comply with Apple's latest design rules for software packaging and code signing, the executables are no longer part of the Resources sub-folder as in earlier versions of the applications. When you upgrade to version 4.6 or later, modify your paths to use the MacOS folder instead.
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 internal location identifiers defined
by Apple which are stored in the firmware of each computer model. 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 being displayed 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:
Identifier | Meaning |
---|---|
TEMPERATURE | temperature |
VOLTAGE | voltage |
CURRENT | current (amperage) |
POWER | power |
CAPACITY | capacity |
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) |
COUNTER | counter value |
FREQUENCY | frequency |
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 Valid for all users of this computer.
The synopsis is as follows:
tempmonitor [-c | -f | -k] [-ds] [[-a] [-l] | [-th | -tv]]
The program will display the current reading (value and unit) of the first
temperature sensor located in the vicinity of the first processor. 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 being displayed 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 using the option -a
, all readings of all available temperature sensors will be displayed, one line for each sensor. When using the option -l
each value will be prefixed by a sensor name according to the pattern
sensor-name: value unit
Sensor names are the internal location identifiers defined by Apple which are stored in the firmware of each computer model.
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.
The program tempmonitor is compatible with the
program tempSensor which was distributed with earlier versions
of Temperature Monitor. It tries to behave similarly. The option -i
which
was available in tempSensor to display sensor information is no
longer supported, however.
The display of S.M.A.R.T. hard disk sensors is only possible if the command-line program is kept within the bundle of the "big" application, and a chdir (cd) has been executed to make the Resources folder the current directory. If these requirements are not met, the program will quietly ignore all hard disk sensors. They are omitted from the output. This only affects computers with processors based on PowerPC technology. On Intel-based Macs, S.M.A.R.T. drive sensors can be accessed without this requirement.
In case of problems, the commands will send error messages to the standard error channel. Upon return, the programs use the following exit codes:
0 - the command was executed successfully, 1 - there was an error in the command line arguments, 2 - the command cannot be used with this computer because no supported sensor was found.
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