Skip to content

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.

17 thoughts on “See sensor stats in Terminal”

  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.

  4. I have tried "istats -f --no-graph" on my mbp and i get "Error] invalid option: -f" how do you display the cpu temp in fahrenheit?

    1. There are two dashes before the "no graph" option:

      istats -f --no-graph

      I just tested it, and it's still working as described.

      -rob.

    1. That'd have to come from the istats folks, but I don't know if that info is even available.

      -rob.

    1. There's a note on the iStats page:

      If you are running an older version of OS X and the install fails you might want to try running this command instead: sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install iStats

      Maybe that will work for you?

      -rob.

      1. I ran that command and still couldn't initiate installation. Apparently the server rejects any attempts to connect over SSL on part of my computer. This is annoying - 2 years after the last security patches is not squeaking antiquity.

Comments are closed.