Built with Vibe Coding (DeepSeek V4.1 Flash / OpenCode).
A lightweight macOS menu bar temperature monitor for Apple Silicon (M-series chips).
- Real-time CPU / GPU temperature display in the menu bar
- Switchable CPU and GPU mode
- Celsius / Fahrenheit unit switch
- Color-coded temperature display (optional):
- Blue: < 35°C (Low)
- Green: 35–45°C (Normal)
- Orange: 46–55°C (High)
- Red: ≥ 56°C (Overheating)
- Icon prefix mode (optional) — colored dot ● before temperature for better visibility
- Dot-only mode (optional) — show only the colored dot ●, hiding the number
- Trend indicator (optional) — reuse the dot: steady ●, rising ▲, falling ▼ (equal-width glyphs, no layout shift)
- Fan speed display with RPM range (read on menu open)
- Session peak — highest / lowest temperature since the last wake / unlock (per mode), shown at the top of the menu
- One-click open Activity Monitor
- One-click open GitHub repository
- Restart or quit directly from the menu
- Version label in menu
- Configurable refresh interval with presets (1s / 2s / 3s / 5s / 10s / 15s / 30s / 45s / 60s) and fine-tuning (±1s)
- Settings persistence across restarts
- Launch at login option
- English / Chinese menu language switch (defaults to English)
- No Dock icon — lives entirely in the menu bar
- macOS 15.0 (Sequoia) or later
- Apple Silicon Mac (M-series) only — Intel Macs are not supported
SwiftTempBar reads hardware temperature sensors through macOS private IOKit/HID APIs, and fan speed through the Apple SMC (System Management Controller):
- IOHIDEventSystemClientCreate — creates a HID system client
- IOHIDEventSystemClientSetMatching — filters devices by
UsagePage=0xFF00, Usage=5(temperature sensors) - IOHIDEventSystemClientCopyServices — enumerates all matching sensor services
- IOHIDServiceClientCopyProperty — reads each sensor's name ("Product")
- IOHIDServiceClientCopyEvent — for sensors matching the selected mode only, retrieves a temperature event (
kIOHIDEventTypeTemperature = 15) - IOHIDEventGetFloatValue — extracts the temperature value
Sensors are classified by name prefix:
- CPU:
PMU tdie,PMU tdev,pACC MTR Temp,eACC MTR Temp, etc. - GPU:
GPU MTR Temp Sensor,PMU2 tdie,PMU2 tdev, etc.
Reading the name is essentially free while copying the event is comparatively expensive, so names are matched first and only the relevant sensors are queried. The HID client is rebuilt on every read rather than cached, which keeps sensor enumeration robust at negligible cost.
The private APIs are loaded at runtime via dlopen/dlsym — no bridging headers or ObjC needed.
- IOServiceMatching("AppleSMC") — opens a connection to the SMC service
- IOConnectCallStructMethod — sends SMC commands (read key info / read bytes)
- FNum — reads fan count (
ui8type) - F%dAc / F%dMn / F%dMx — reads current / minimum / maximum RPM per fan (
fltorfpe2type)
Sources/
├── StatusBarController.swift # App entry (@main), menu bar UI, settings
├── TemperatureReader.swift # HID sensor reading (pure Swift)
├── FanReader.swift # SMC fan speed reading (pure Swift)
├── Assets.xcassets/ # App icon
└── Info.plist
Only 3 Swift source files. No Storyboards, no ObjC, no dependencies.
Requires an Xcode toolchain with Swift 6. The project targets macOS 15.0 and produces an arm64-only binary.
xcodebuild -project SwiftTempBar.xcodeproj -scheme SwiftTempBar -configuration Release buildOpen SwiftTempBar.xcodeproj in Xcode to run it from the IDE.
- SwiftTempBar uses private IOKit/HID and SMC interfaces, so it is intended for local, personal use and is not suitable for distribution on the Mac App Store.
- Temperatures are read directly from hardware sensors and are indicative rather than calibrated.
This project was inspired by and derived from:
- SolitaryJune/TempBarApp (BSD-3)
- Cliffback/macos-temp-tool (BSD-3)
- freedomtan/sensors (BSD-3)
See LICENSE.

