CPU temperature and hardware sensor readouts in bash

Oct 25, '05 06:30:00AM

Contributed by: 31d1

While hunting around in ioreg I found a bunch of hardware sensor readouts, including CPU and GPU temperatures. I had no idea this stuff was available without a compiled app, so I excitedly whipped up a bash script (tp v0.1) to display the values.

I realize that the number of sensors and ioreg formatting varies wildly between various Macs, so I sacrificed some formatting to try and make sure that it will display all possible sensors on a given machine, and at least be legible.

This should work on most recent Macs, but if you try this script out, please post a comment stating what machine you are running -- especially if it displays any garbage on your machine, as I'd like to know so I can fix it.

Download, chmod a+x scriptname, put in your PATH, and tp -h for help.

[robg adds: I tested this, and it worked well on my PowerBook. Here's what it spit out:

$ tp -l
PowerBook G4 12"  PowerBook6,4  PowerPC G4  (1.1)  
45.25    HDD BOTTOMSIDE Celsius
48       CPU TOPSIDE Celsius
54.75    GPU ON DIE Celsius
0.99316  CPU CORE volts
0        REAR MAIN ENCLOSURE fan RPM
28       BATTERY Celsius
I have also mirrored the script on macosxhints.com, in case it vanishes from the above link...]

Comments (26)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20051021115356696