A pure-Rust fan-control driver for Mac mini and Mac Studio (Apple silicon, AppleSMC). It does not run on GitHub runners, Intel Macs, or anything without an SMC fan. Loads as a macOS startup item (launchd LaunchDaemon), reads the hottest CPU/GPU temperature sensor, and drives the fan with a stepped curve:
| Band | Threshold | Fan target |
|---|---|---|
| quiet | below 60 °C | min RPM |
| balanced | ≥ 60 °C | 45 % of range |
| boost | ≥ 75 °C | 70 % of range |
| full | ≥ 90 °C | 100 % of range |
| failsafe | ≥ 100 °C | 100 % of range (forced) |
The 100 °C → full-speed rule is a hard invariant inside the control crate — config cannot weaken it.
Safety first. Every failure path (sensor loss, unlock failure, panic, SIGTERM) hands the fan back to Apple's own
thermalmonitord. The SMC firmware retains independent thermal protection regardless of our state. Do not run alongside Macs Fan Control, TG Pro, or similar.
Verified on this machine: Mac mini M4 Pro (Mac16,11) · macOS 26.6.2 ·
1 fan, range 1000–4900 RPM · mode key F0Md · Ftst absent.
Open the control architecture diagram in a browser.
Design narrative: docs/DESIGN.md.
launchd (startup item)
└── minifand (root LaunchDaemon)
├── minifan-control ← pure logic: curve, hysteresis, slew, failsafes
└── minifan-smc ← AppleSMC IOKit bindings (zero deps)
└── AppleSMC.kext → SMC firmware (RTKit) → Fan F0 / sensors
minifan (CLI) → same libraries, for status / probe / simulate / set / auto
brew install rachitdev/tap/minifan
sudo brew services start minifanThat builds minifan (CLI) and minifand (daemon) from source on this Mac
and loads a root LaunchDaemon. Apple silicon Mac mini / Studio only.
minifan status
sudo brew services stop minifan
sudo minifan auto # hand the fan back to Apple
brew uninstall minifancd MacMiniFanDriver
cargo build --release
./target/release/smc-probe # fans + every temperature sensor
./target/release/minifan status # hottest CPU/GPU + desired band
./target/release/minifan simulate # synthetic load → band → RPM
./target/release/minifand --dry-run --once # one full control cycle, no writesOption A — DMG installer (unsigned PKG-in-DMG):
open dist/MacMiniFanDriver-0.1.0.dmg
# double-click MacMiniFanDriver-0.1.0.pkg
# unsigned build: Gatekeeper may warn → right-click → Open → OpenRebuild after code changes with ./packaging/build-dmg.sh.
Option B — straight from source:
sudo ./packaging/install.shThis builds release binaries, installs them to /usr/local/bin, drops the
config at /usr/local/etc/minifan/config.toml, and loads
com.minifan.daemon into launchd (RunAtLoad + KeepAlive — boots with
the machine and restarts if it exits).
minifan status
tail -f /var/log/minifand.log
sudo ./packaging/uninstall.sh # full removal; fan returned to Apple/usr/local/etc/minifan/config.toml (also see
packaging/config.toml):
poll_interval_ms = 1500
hysteresis_c = 4.0 # downward only — no flapping at band edges
overtemp_c = 100.0 # hard failsafe → 100 %
max_rpm_step = 400 # acoustic slew limit (rpm per poll)
sensors = "auto" # or ["TCMz", "Tp2G", "Tg0k"]
[[step]]
name = "balanced"
threshold_c = 60.0
target_pct = 45.0
# … boost @ 75 → 70 %, full @ 90 → 100 %SIGHUP reloads the config without dropping control. Unknown keys are a
hard error — a typoed config can never silently change thermal behaviour.
| Command | Privileges | Purpose |
|---|---|---|
minifan status |
none | fans, sensors, hottest CPU/GPU, desired band, daemon state |
minifan probe |
none | full read-only discovery (same as smc-probe) |
minifan simulate |
none | replay a synthetic thermal trace through the curve |
minifan config |
none | validate and print the resolved configuration |
minifan set <RPM> |
root | acquire manual control and hold a fixed speed |
minifan auto |
root | return the fan to Apple auto control |
MacMiniFanDriver/
├── Cargo.toml # workspace
├── crates/
│ ├── smc/ # AppleSMC IOKit bindings, codecs, unlock
│ ├── control/ # curve, hysteresis, slew, failsafes
│ ├── daemon/ # minifand LaunchDaemon
│ └── cli/ # minifan CLI
├── packaging/
│ ├── com.minifan.daemon.plist
│ ├── config.toml
│ ├── install.sh
│ ├── uninstall.sh
│ └── build-dmg.sh
└── docs/
├── DESIGN.md
├── TESTING.md
└── architecture.html
Zero runtime crate dependencies. The only linkage is the macOS IOKit
framework (system-provided).
Apple Silicon generations differ:
- Try a direct write of the mode key (
F0Md/F0md) to1. - If the firmware rejects it with
0x82(system mode held bythermalmonitord) and theFtstdiagnostic key exists, writeFtst=1and retry for up to 10 s — the documented M3/M4 path. - On this Mac mini M4 Pro,
Ftstis absent and the direct path is the one that matters. The unlock fallback is kept for other hardware.
Sleep/wake clears the unlock. The daemon's watchdog re-checks the mode key every poll and re-acquires transparently.
| Failure | Response |
|---|---|
| Sensor read fails 3× | Revert fan to Apple control |
| Fan range unusable | Revert |
| Mode / target write fails | Revert; retry takeover every 30 s |
| Sleep/wake clears unlock | Watchdog re-acquires |
| SIGTERM / SIGINT | Revert, exit |
| Panic in the control loop | catch_unwind → fresh-connection revert |
| Another fan controller installed | Installer refuses to proceed |
If MacMiniFanDriver keeps your Mac mini cool and quiet, consider a small donation — it goes straight into test hardware and coffee ☕
GitHub Sponsors — one-time or monthly tiers ($5 / $10 / $20 or ₹ equivalents).
MIT. Protocol research credits in docs/DESIGN.md.
Not affiliated with or endorsed by Apple Inc. Use at your own risk —
monitor temperatures carefully, especially the first time you enable live
writes.