The Robservatory

Robservations on everything…

 

See sensor stats in Terminal

Someone—perhaps it was Kirk—pointed me at this nifty Ruby gem to read and display your Mac’s sensors in Terminal: iStats — not to be confused with iStat Menus, a GUI tool that does similar things.

Installation is sinmple, via sudo gem install iStats. After a few minutes, iStats will be ready to use. In its simplest form, call istats by itself with no parameters. Normally I’d list the Terminal output here, but istats (by default, can be disabled) presents informatiomn with neat little inline bar graphs, so here’s a screenshot:

This tool is especially useful on a laptop, as it provides an easy-to-read battery summary.

Beyond the basics, you can tell the tool to look for additional sensors—use istats scan, and you’ll see output like this (I added the --no-graph parameter to suppress the graphs):

$ istats --no-graph scan
Scanning keys...

Th1H NB/CPU/GPU HeatPipe 1 Proximity  39.88°C  
Ts0P Palm rest L  25.06°C  
Ts0S Memory Bank Proximity  -127.0°C  
Ts1S Unknown  -127.0°C  
TA0P Ambient temperature  31.88°C  
TBXT Unknown  24.39°C 
...
...

At the end of the list, istats tells you exactly how to add a given key to the output:

Done scanning keys.
All keys are disabled by default. Use istats enable [key] to enable specific keys or istats enable all. The enabled sensors will show up when running istats or istats extra

For example, I can add the temperature sensor for the left palm rest (there doesn’t appear to be one for the right) on my 13″ rMBP by running istats enable Ts0P, as that’s the key next to the entry in the scan output. Add as many as you like, and they’ll show in the Extra Stats section of a normal istats run … and yes, you can see temps in Fahrenheit if you prefer, with the -f parameter:

$ istats -f --no-graph
--- CPU Stats ---
CPU temp: 133.25°F 

--- Fan Stats ---
Total fans in system: 1
Fan 0 speed: 1300.0 RPM  

--- Battery Stats ---
Battery health: Good
Cycle count: 157    15.7%
Max cycle count: 1000
Current charge:  4904 mAh  89%
Maximum charge:  5781 mAh   91.3%
Design capacity: 6330 mAh
Battery temp: 81.5°F  

--- Extra Stats ---
Ts0P Palm rest L temp: 78.35°F  
TA0P Ambient temperature temp: 90.5°F  
TCSA PECI SA temp: 141.8°F

There’s a lot more you can do; use istats --help to see the available usage modes.

10 Comments

Add a Comment
  1. Nice little tool, thanks! By the way, if you install ruby with homebrew, and set your PATH variable to look at /usr/local/bin first, you can install gems without sudo privileges. Helps keep the system clean, I think.

    1. That’s a great idea; I’d never thought to use homebrew. Great, now I have a new project for the day ;).

      thanks;
      -rob.

        1. I was joking about the “difficulty” of installing the homebrew version of ruby ;).

          -rob.

          1. Odd, supposedly WordPress supports emoji, though I admit I’ve never tried … ???? … let’s see if I get a thumb or question marks. If the latter, then I guess I really do have a project to look into for the day!

            -rob.

  2. So, do you need to do a special Ruby installation before this will work? I keep getting an error on installation that it “can’t find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h”. I looked and there is no “include” folder there.

  3. I think you’d have to either have Xcode installed or the command line build tools installed.

Leave a Reply

The Robservatory © 2017 Built from the Frontier theme