smcFanControl icon indicating copy to clipboard operation
smcFanControl copied to clipboard

Syntax for Terminal Command to Read CPU Temps

Open T3chGuy77 opened this issue 5 years ago • 2 comments
trafficstars

I'm attempting to write a script to use the ./smc to read CPU temperatures so I can monitor them with PRTG remotely. Currently if I try ./smc -r TC1C I get a message back saying "Error: specify a key to read. So apparently I have the syntax wrong as there are no examples in the ReadMe for this command. Can I get a little help please. Also can you include examples of each command in the ReadMe file so we can help ourselves. Thanks!

T3chGuy77 avatar Oct 19 '20 16:10 T3chGuy77

Go figure....I figured it out on my own. To read the CPU temperature value the syntax is as follows:

./smc -k TC1C -r

So now hopefully I can finish writing my script to read those values. I have a Mac Mini server 6,2 that might be overheating for some reason but now that I have a monitor running to control the fan speed it may never overheat again. Sad because the only thing this server does is run a simple licensing app to serve AutoDesk licenses to a lab of 20 WIndows machines.

T3chGuy77 avatar Oct 19 '20 16:10 T3chGuy77

You can also use powermetrics(8):

Text output (click to show output)
sudo powermetrics --samplers smc -i1 -n1        
**** SMC sensors ****

CPU Thermal level: 0
GPU Thermal level: 0
IO Thermal level: 0
Fan: 1838.46 rpm
CPU die temperature: 48.69 C
GPU die temperature: 35.00 C
CPU Plimit: 0.00
GPU Plimit (Int): 0.00 
Number of prochots: 0
Machine-readable output (click to show output)
sudo powermetrics --samplers smc -i1 -n1 -fplist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>is_delta</key><true/>
<key>elapsed_ns</key><integer>7663795</integer>
<key>hw_model</key><string>MacBookPro16,1</string>
<key>smc_version</key><string>Unknown</string>
<key>efi_version</key><string>1715.5.0</string>
<key>kern_osversion</key><string>21C52</string>
<key>kern_bootargs</key><string>chunklist-security-epoch=0 -chunklist-no-rev2-dev</string>
<key>kern_boottime</key><integer>1641036771</integer>
<key>timestamp</key><date>2022-01-02T05:24:23Z</date>
<key>smc</key>
<dict>
<key>cpu_thermal_level</key><integer>0</integer>
<key>simulated_cpu_thermal_level</key><integer>0</integer>
<key>gpu_thermal_level</key><integer>0</integer>
<key>simulated_gpu_thermal_level</key><integer>0</integer>
<key>io_thermal_level</key><integer>0</integer>
<key>simulated_io_thermal_level</key><integer>0</integer>
<key>fan</key><real>1847.3</real>
<key>cpu_die</key><real>47.18</real>
<key>cpu_die_power_target</key><real>98</real>
<key>cpu_die_fan_target</key><real>93</real>
<key>gpu_die</key><real>35.00</real>
<key>gpu_die_power_target</key><real>98</real>
<key>gpu_die_fan_target</key><real>93</real>
<key>cpu_plimit</key><real>0.00</real>
<key>gpu_plimit</key><real>0.00</real>
<key>num_prochots</key><integer>0</integer>
<key>cpu_prochot</key><false/>
<key>smc_prochot</key><false/>
</dict>
</dict>
</plist>

Of course, this requires superuser privileges, so it isn't a complete replacement for smcFanControl. But it's helpful to know.

Alhadis avatar Jan 02 '22 06:01 Alhadis