Temperature monitor
  • C 98.4%
  • Makefile 1.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-23 21:35:26 +08:00
.gitignore first commit 2026-08-23 12:14:45 +08:00
Makefile add support for macos 2026-08-23 21:35:26 +08:00
README.md add support for macos 2026-08-23 21:35:26 +08:00
sensors.c add support for macos 2026-08-23 21:35:26 +08:00
sensors.h add support for macos 2026-08-23 21:35:26 +08:00
sensors_linux.c add support for macos 2026-08-23 21:35:26 +08:00
sensors_macos.c add support for macos 2026-08-23 21:35:26 +08:00
tempmon.c add support for macos 2026-08-23 21:35:26 +08:00

tempmon

A terminal temperature monitor for Linux and macOS. Shows a live scrolling graph of any thermal sensor, viewable over several timeframes.

tempmon   sensor: PMU tdie3                          interval: 1s  [q]uit
window: 5m
current:   48.0 C     min:   45.0 C     max:   52.0 C     avg:   47.3 C

   52
                                                ▁▂▃▅▆▇████▇▆▅▄▃▂▁▂▃▅▇█
   48

   44
        -5m                                                     now

[1]60s [2]5m [3]15m [4]1h [5]6h [6]24h
n: switch sensor   1-6: timeframe   q: quit

Features

  • Live scrolling graph of any temperature sensor on the system
  • Auto-discovers sensors on both Linux and macOS (see below)
  • Switch between six timeframes (60s, 5m, 15m, 1h, 6h, 24h) without losing history — up to 24h of per-second samples are kept
  • Scrolling, searchable-by-eye sensor picker, or jump straight to one by id
  • Color-coded readings (green/yellow/red) at configurable warning/hot thresholds
  • Auto-scaling y-axis, min/max/avg stats for the visible window
  • No root required on either platform

Sensor sources

Linux reads /sys/class/thermal/thermal_zone* and /sys/class/hwmon/hwmon* (CPU cores, package, NVMe, ACPI, Wi-Fi, etc.).

macOS has no sysfs equivalent, so readings come from IOKit. Two sources are supported and the first one that reports anything wins:

  1. IOHIDEventSystem thermal sensors — on Apple Silicon the SoC, NAND and battery sensors are published under the Apple vendor HID usage page with readable names (PMU tdie3, NAND CH0 temp, gas gauge battery). These functions are private API, so they are resolved at runtime with dlsym; if a future macOS removes them, tempmon falls back to SMC instead of failing to launch.
  2. AppleSMC — present on Intel and Apple Silicon alike, and the only source on Intel Macs. Keys are four-character codes, so the well-known ones are given friendly names (CPU proximity [TC0P], Battery [TB0T]); the rest are listed by raw key (SMC TCHP). The sp78, flt and ioft value encodings are all decoded.

Run tempmon -l to see which source is in use and what it found.

Requirements

  • Linux or macOS
  • A C compiler (gcc or clang)
  • ncurses development headers

On Debian/Ubuntu:

sudo apt install build-essential libncurses-dev

On macOS, the Xcode command line tools provide everything needed:

xcode-select --install

Build

make

This produces a tempmon binary in the project root. The Makefile picks the sensor backend from uname -s; no configuration needed.

Run

./tempmon            # interactive sensor picker
./tempmon -l         # list all detected sensors and exit
./tempmon -s 8       # jump straight to sensor id 8 (see -l for ids)
./tempmon -i 2       # sample every 2 seconds (default 1)

Keybindings

In the graph:

Key Action
1–6 Select timeframe (60s/5m/15m/1h/6h/24h)
n Switch to a different sensor
q Quit

In the sensor picker:

Key Action
Up/Down Move selection
PgUp/PgDn Move a page at a time
Home/End Jump to first / last sensor
Enter Select
q / Esc Back / quit

Project layout

tempmon.c        - sampling, downsampling, ncurses UI
sensors.h        - platform-independent sensor interface
sensors.c        - sensor table shared by the backends
sensors_linux.c  - sysfs backend
sensors_macos.c  - IOKit HID / AppleSMC backend
Makefile

Disclaimer

This project was written with the assistance of AI. The code and documentation were largely AI-generated and then reviewed by a human. Review it yourself before relying on it for anything important.