macOS menu bar system monitor -- real-time power consumption, CPU usage, and RAM usage with custom vector icons and gradient energy bars.
PowerIcon 12.3W | CPUIcon 23% | MemoryIcon 67%
- Real-time monitoring -- Power (W), CPU (%), RAM (%) in the menu bar
- Custom vector icons -- Hand-drawn lightning bolt, chip, and DIMM shapes (no emoji, no SF Symbols)
- Gradient energy bars -- Capsule-shaped progress bars with spring animation
- Power: orange to yellow
- CPU: blue to cyan
- RAM: green to mint
- Turns red at >80%, pulses at >95%
- Detail panel -- Click to see breakdowns (CPU/GPU/ANE power, per-core CPU, Active/Wired/Compressed memory)
- Trend charts -- Mini line charts with 60-sample history (Swift Charts)
- Configurable -- Choose which metrics to display, adjust refresh interval (1-10s)
- Low overhead -- Target: <20MB memory, <1% CPU
- Menu bar only -- No Dock icon (LSUIElement)
- macOS 14.0 (Sonoma) or later
- Apple Silicon or Intel Mac
- Xcode Command Line Tools (
xcode-select --install)
# 1. Clone the repo
git clone https://github.com/ChristopherCC-Liu/MacPowerMeter.git
# 2. Enter the directory
cd MacPowerMeter
# 3. Run the installer (builds + installs + creates CLI command)
# You will be prompted for your password (needed to create /usr/local/bin/powermeter)
./install.shIf you already have a MacPowerMeter directory from a previous install:
# Enter your existing directory
cd MacPowerMeter
# Pull the latest changes
git pull origin main
# Reinstall
./install.sh# Option A: Remove old directory and start fresh
rm -rf MacPowerMeter
git clone https://github.com/ChristopherCC-Liu/MacPowerMeter.git
cd MacPowerMeter
./install.sh
# Option B: Update inside the existing directory
cd MacPowerMeter
git pull origin main
./install.sh- Compiles the release binary via Swift Package Manager (
swift build --configuration release) - Creates a
.appbundle with proper Info.plist - Copies the
.appto/Applications/MacPowerMeter.app - Creates a
powermeterCLI command at/usr/local/bin/powermeter
After installation, use any of these methods to launch:
# From terminal
powermeter # Launch (appears in menu bar)
powermeter stop # Quit the app
powermeter status # Check if running
powermeter help # Show all commandsOr launch from Spotlight: press Cmd+Space, type "MacPowerMeter", hit Enter.
Or double-click /Applications/MacPowerMeter.app in Finder.
The app appears as an icon in your menu bar (no Dock icon). Click it to open the detail panel.
Click the menu bar item to open the detail panel. At the bottom you'll find settings:
- Refresh interval -- 1 / 2 / 5 / 10 seconds
- Status Bar -- Toggle power, CPU, RAM display independently
- Launch at Login -- Start automatically on boot
- Quit -- Exit the app
Settings take effect immediately and persist across app restarts.
cd MacPowerMeter
./install.sh uninstallThis removes /Applications/MacPowerMeter.app and /usr/local/bin/powermeter.
MacPowerMeter/
Models/ SystemMetrics (immutable struct) + MetricsHistory (ring buffer, 60 samples)
Collectors/ CPUCollector (Mach API) / MemoryCollector (vm_statistics64) / PowerCollector (strategy)
Engine/ MetricsEngine actor -- async let parallel collection, AsyncStream output
ViewModels/ @Observable ViewModel -- subscribes to engine, drives UI
Views/
Icons/ PowerIcon / CPUIcon / MemoryIcon (SwiftUI Shape + Path)
Components/ EnergyBar (gradient capsule) / MiniChart (Swift Charts)
... StatusBarLabel / MetricsPanel / SettingsView
Theme/ ColorTheme (3 color schemes, light/dark adaptive)
Utilities/ LaunchAtLogin (SMAppService)
CPUCollector ---+
MemoryCollector -+--> MetricsEngine (actor) --> AsyncStream --> MetricsViewModel (@Observable) --> SwiftUI
PowerCollector --+
Power data collection uses a strategy pattern with automatic fallback:
- IOReport (primary) -- Apple's private framework for energy model data. Provides per-component breakdown (CPU/GPU/ANE). Loaded dynamically via
dlopen. - SMC (fallback) -- Direct AppleSMC access via IOKit. Reads hardware power keys (PSTR, PHPC, PCPG). Works when IOReport is unavailable.
- Degraded mode -- If both methods fail, the power section is hidden automatically.
Supports both Apple Silicon (little-endian SMC) and Intel Mac (big-endian SMC).
# Debug build
swift build
# Release build
swift build --configuration release
# Run directly (without .app bundle)
.build/release/MacPowerMeter
# Create .app bundle only (without installing to /Applications)
./create-app-bundle.sh"zsh: no such file or directory: ./install.sh"
Make sure you are inside the MacPowerMeter directory: cd MacPowerMeter
"destination path already exists"
You already have the directory. Update instead: cd MacPowerMeter && git pull origin main && ./install.sh
Power shows 0W or is hidden
Power monitoring requires non-sandboxed execution. If running from Xcode, disable App Sandbox. The installed .app bundle is non-sandboxed by default.
Build fails with "swift: command not found"
Install Xcode Command Line Tools: xcode-select --install
MIT