Linux Fan Control & ThermalCtl

Linux v2.0.0 · macOS v1.0.0 · BSD-3-Clause

Two native hardware fan controllers and thermal monitors sharing one normalized curve engine, configuration schema, and Unix-socket IPC protocol: linux-fan-control for Linux (Apple SMC and generic hwmon PWM) and ThermalCtl for macOS (native SwiftUI, MenuBarExtra, and IOKit AppleSMC).

Status (2026-11-28): Both repositories run a privileged background daemon that owns all hardware writes, authenticates mutating IPC requests via peer credentials, supports an explicit firmware automatic mode, and restores hardware firmware control on exit.

Signed Releases

Developer ID codesigned macOS Universal (arm64 + x86_64) installers from cook0001/ThermalCtl and GPG-signed Linux packages from cook0001/linux-fan-control:

Platform & Format Contents & Verification Download
macOS Universal App (.dmg) Universal Apple Silicon (arm64) + Intel (x86_64) ThermalCtl.app, Developer ID codesigned with Hardened Runtime. ThermalCtl-1.0.0-mac-universal.dmg
macOS Universal Installer (.pkg) Installs ThermalCtl.app, thermalctld LaunchDaemon, and thermalctl CLI; signed with Developer ID Installer. ThermalCtl-1.0.0-mac-universal.pkg
macOS Checksums & GPG SHA256SUMS.txt, detached GPG signature SHA256SUMS.txt.asc, and signing key KEYS.asc. SHA256SUMS.txt · SHA256SUMS.txt.asc · KEYS.asc
Linux Debian / Ubuntu (.deb) Native package with systemd unit, GTK4 GUI, tray indicator, CLI, and detached GPG signature (.asc). linux-fan-control_2.0.0_all.deb
Linux Fedora / RHEL (.rpm) Native RPM signed with rpmsign plus detached GPG signature (.asc). linux-fan-control-2.0.0-1.noarch.rpm
Linux Checksums & GPG SHA256SUMS.txt, detached GPG signature SHA256SUMS.txt.asc, and signing key KEYS.asc. SHA256SUMS.txt · SHA256SUMS.txt.asc · KEYS.asc

Platforms & Repositories

Linux — linux-fan-control

v2.0.0 · Python · GTK4 + Libadwaita

Targets Linux workstations, desktops, and Macs running Linux through kernel sysfs interfaces (/sys/devices/platform/applesmc.* and /sys/class/hwmon/hwmon*).

  • Hardened systemd daemon (linux-fan-controld) listening on /run/linux-fan-control/daemon.sock with SO_PEERCRED authorization.
  • Theme-aware GTK4 + Libadwaita desktop app using native Gtk.DrawingArea charts and background IPC polling, plus an Ayatana top-panel indicator.
  • Universal multi-fan RPM and PWM duty-cycle translation, dynamic CPU/GPU sensor discovery, and core26 Snap packaging metadata.

macOS — ThermalCtl

v1.0.0 · Swift · SwiftUI + IOKit

Native macOS 13+ Swift implementation with zero Python runtime dependency and an ABI-verified 80-byte C bridge (CSMC) to Apple's kernel AppleSMC user client.

  • Root launchd daemon (com.cook0001.thermalctld) listening on /var/run/thermalctl/daemon.sock with getpeereid checks for root, admin, and wheel.
  • Native SwiftUI 5-tab desktop window (Dashboard, Curve, Telemetry, Tuning, Sensors) paired with a live MenuBarExtra displaying RPM, temperature, and profile controls.
  • Supports Intel SMC formats (fpe2, sp78, {fds, FS! bitmask, F{i}Md) and Apple Silicon float codecs (flt , F{i}Md).

Linux Setup (linux-fan-control)

Clone cook0001/linux-fan-control, install the desktop wrappers and hardened systemd service, then control curves via GUI, system tray, or CLI:

Install Desktop & Daemon

systemd · GTK4 · Ayatana

enable-control.sh stops conflicting fan daemons (mbpfan, macfanctl, fancontrol, thinkfan, coolercontrol), removes legacy 0666 udev rules, authorizes the invoking user, and starts linux-fan-controld.service.

$ git clone https://github.com/cook0001/linux-fan-control.git && cd linux-fan-control
$ ./scripts/setup-desktop.sh
$ sudo ./scripts/enable-control.sh

Linux CLI & Desktop Commands

linux-fan-control

Query telemetry (read-only even when the daemon is stopped), switch profiles, lock manual effort, or hand control back to hardware firmware:

$ linux-fan-control status
$ linux-fan-control set-profile balanced
$ linux-fan-control auto
$ linux-fan-gui && linux-fan-tray

macOS Setup (ThermalCtl)

Build from source on macOS 13+ with Xcode or Swift Command Line Tools. Read-only SMC telemetry works immediately without root; install the launchd daemon to write fan targets:

Build App Bundle & Probe SMC

SwiftPM · macOS 13+

build-app.sh compiles release binaries for ThermalCtlApp, thermalctld, and thermalctl, renders a multi-resolution AppIcon.icns, and assembles dist/ThermalCtl.app.

$ git clone https://github.com/cook0001/ThermalCtl.git && cd ThermalCtl
$ ./scripts/build-app.sh
$ open dist/ThermalCtl.app
$ ./.build/release/thermalctl probe-smc

Install LaunchDaemon & CLI

launchd · thermalctld

Stop any competing fan utility before installing com.cook0001.thermalctld. Uninstalling automatically sends auto to restore hardware SMC firmware control.

$ sudo ./scripts/install-daemon.sh
$ thermalctl status
$ thermalctl set-profile balanced
$ sudo ./scripts/uninstall-daemon.sh

Shared Curve Engine & IPC Protocol

Subsystem Behavior Cross-Platform Invariant
Normalized Curves (v2) Profiles (quiet, balanced, performance, maximum, custom) store [temp_c, percent] pairs mapped to each fan's hardware min_rpm..max_rpm or PWM bounds. Identical presets scale across Mac Pro blowers, MacBook turbines, and PC chassis fans; legacy v1 RPM configs migrate automatically on load.
Firmware Auto Mode Explicit firmware profile restores AppleSMC automatic control (fan_manual=0 / clearing FS! bit / F{i}Md=0) or hwmon pwm_enable=2. Leaves hardware curves untouched during normal operation while keeping the critical temperature emergency clamp armed.
Hysteresis & Smoothing Monotonic time-window moving average damps brief spikes; configurable deadband holds fan speed until temperatures drop past threshold, then steps down at step_down_rate (%/s). Evaluated exactly once per 1-second daemon tick; status queries never mutate state, and peak tracking resets once step-down reaches the cooled target.
Framed Unix IPC Line-delimited JSON requests and responses capped at 64 KiB with 1-second socket timeouts on both client and daemon. Both Linux Python and macOS Swift daemons expose identical actions (status, get_history, set_profile, set_custom_curve, set_tuning, set_alerts, set_manual, reset_auto).
Safety Alerts Critical temperature override forces all writable fans to 100% regardless of profile or manual lock; stall detection checks every detected fan against its active target RPM. Respects alerts.enabled in both daemon alert generation and desktop notifications.

Security & Privilege Architecture

Control Linux (linux-fan-control) macOS (ThermalCtl)
Hardware Write Ownership Root systemd service owns all sysfs writes; no chmod 0666 udev rules or world-writable hardware nodes. Root launchd daemon owns all AppleSMC write calls via IOConnectCallStructMethod.
IPC Peer Authorization SO_PEERCRED gates mutating commands to root, members of fancontrol/sudo/wheel/adm, or UIDs in /etc/linux-fan-control/authorized_uids. getpeereid gates mutating commands to root, members of admin or wheel, or explicit THERMALCTL_ALLOWED_UIDS.
Config & Fallback Atomic 0644 writes at /etc/linux-fan-control/config.json; non-daemon fallback is strictly read-only. Atomic 0644 writes at /Library/Application Support/ThermalCtl/config.json; non-daemon fallback reads SMC without writing.
Fail-Safe Shutdown SIGINT / SIGTERM handlers restore firmware mode and unlink the daemon socket on exit. DispatchSource signal handlers restore SMC firmware mode and remove the Unix socket on shutdown.

Verification & Testing

  • Shared Curve Parity: Both Python (python3 -m unittest discover -s tests -v) and Swift (swift test) validate their curve engines against identical deterministic scenarios in curve_vectors.json covering ramp-up, deadband hold, peak reset after step-down, spike smoothing, and emergency override in firmware mode.
  • Live macOS Intel SMC Verification: Read-only AppleSMC discovery, 80-byte C struct layout (_Static_assert), {fds fan labels, FS! mode bitmask, and dual-GPU + CPU PECI sensors were verified directly on a MacPro6,1 (AppleSMC 2.20f18).
  • Platform Notes: Apple Silicon float SMC codecs (flt , F{i}Md) are unit-tested and should be verified on physical Apple Silicon hardware before relying on manual overrides; Linux GTK4/Libadwaita UI, Ayatana tray, and systemd integration are unit-tested with mock sysfs trees and intended for runtime testing on Linux desktops.
$ python3 -m unittest discover -s tests -v
$ swift test