Changes: - Add GitHub repository URL: https://github.com/ersinkoc/SystemMonitor - Update author: Ersin KOC - Add social links: @ersinkoc (X/Twitter) - Add GitHub badges to README - Update LICENSE copyright holder - Add author section to README - Update all repository URLs in documentation Author: - Name: Ersin KOC - GitHub: github.com/ersinkoc - X/Twitter: x.com/ersinkoc Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| SystemMonitor | ||
| SystemMonitor.app/Contents | ||
| SystemMonitorTests | ||
| .gitignore | ||
| BUILD.md | ||
| LICENSE | ||
| Package.swift | ||
| README.md | ||
| run_tests.sh | ||
| TEST_COVERAGE_REPORT.md | ||
| verify.swift | ||
System Monitor for macOS
A professional-grade, feature-rich system monitoring app for macOS 14+
Built with pure Swift & SwiftUI | Open Source | Production Ready
Created by Ersin KOC | @ersinkoc
Features • Installation • Build • Usage • License
✨ Features
📊 CPU Monitoring
- Real-time overall CPU usage (%)
- Per-core usage breakdown (P-cores & E-cores on Apple Silicon)
- User/System/Idle time breakdown
- CPU frequency monitoring (MHz)
- Thermal state tracking (Nominal/Fair/Serious/Critical)
- 5-minute historical chart with smooth animations
🎮 GPU Monitoring
- GPU usage percentage
- Apple Silicon specific: Device/Renderer/Tiler utilization breakdown
- GPU memory tracking (allocated & in-use)
- GPU name/model detection via Metal API
- Architecture detection (Apple Silicon vs Intel)
- Historical usage chart
💾 Memory Monitoring
- Active, Inactive, Wired, Compressed memory breakdown
- Memory pressure indicator (Normal/Warning/Critical)
- Swap usage tracking
- Visual memory breakdown bar with color coding
- 5-minute historical chart
- Real-time percentage display
💿 Disk Monitoring
- Total, used, free space (GB/TB)
- Usage percentage with color coding (Green/Orange/Red)
- Real-time read/write speeds (MB/s, GB/s)
- Dual I/O charts (separate read/write history)
- Total bytes read/written since boot
- Visual space breakdown bar
- Mount point information
🌐 Network Monitoring
- Real-time upload/download speeds
- Dual charts (separate upload/download history)
- Total bytes transferred (in/out)
- Peak speed indicators
- Auto-formatted speeds (B/s → KB/s → MB/s → GB/s)
- Active interface detection (WiFi/Ethernet)
🌡️ Sensors & Fans (Advanced)
- CPU/GPU/System temperatures via SMC (System Management Controller)
- Fan speed monitoring with RPM display
- Manual fan control with safety warnings ⚠️
- System power consumption (Watts)
- Temperature status (Cool/Warm/Hot/Critical)
- Color-coded temperature gauges
- Auto-restore fans to automatic mode on quit
- Emergency "Reset All to Auto" button
⚙️ Settings & Customization
- General Settings:
- Customizable update interval (0.5-5 seconds)
- Launch at login option
- Show/hide in Dock
- Menu Bar Settings:
- Toggle CPU/Memory/Network display
- Icon style selection (Percentage/Icon/Graph)
- Alert Settings:
- CPU usage threshold (50-100%)
- Memory usage threshold (70-100%)
- Temperature threshold (70-100°C)
- macOS native notifications
- 5-minute cooldown between same alerts
📤 Data Export
- Export all metrics to CSV format
- Timestamped data for analysis
- Includes: CPU, GPU, Memory, Disk I/O, Network
- NSSavePanel integration
- Auto-open exported file in Finder
🎯 Menu Bar Integration
- Live CPU percentage display (updates every second)
- Settings-based customization
- Always accessible from menu bar
- Click to open detailed popover (6 tabs)
- Low system resource usage (<5% CPU idle)
🎯 Why SystemMonitor?
| Feature | iStat Menus | Stats | SystemMonitor |
|---|---|---|---|
| CPU Monitoring | ✅ | ✅ | ✅ |
| GPU Monitoring | ✅ | ✅ | ✅ |
| Memory | ✅ | ✅ | ✅ |
| Disk I/O | ✅ | ✅ | ✅ |
| Network | ✅ | ✅ | ✅ |
| Sensors | ✅ | ✅ | ✅ |
| Fan Control | ✅ | ❌ | ✅ |
| Notifications | ✅ | ❌ | ✅ |
| CSV Export | ✅ | ❌ | ✅ |
| Settings Window | ✅ | ⚠️ | ✅ |
| Open Source | ❌ | ✅ | ✅ |
| Modern SwiftUI | ❌ | ✅ | ✅ |
| Price | $11.99 | Free | Free |
📦 Installation
Option 1: Build from Source (Recommended)
See BUILD.md for detailed instructions.
Quick Start:
- Clone repository
- Open in Xcode 15+
- Disable App Sandbox (Signing & Capabilities)
- Build & Run (⌘R)
- Look for gauge icon in menu bar
Option 2: Swift Package Manager
cd SystemMonitor
swift build -c release
.build/release/SystemMonitor
🚀 Usage
Getting Started
- Launch App: Click menu bar icon (gauge symbol)
- Navigate Tabs: Use segmented picker to switch between metrics
- View Details: Each tab shows real-time data + 5-minute history
- Settings: Click "Settings" button in footer
- Export Data: Click "Export" button → Save as CSV
Tab Overview
CPU Tab 📊
- Large percentage display with color coding
- Per-core usage bars (if available)
- User/System/Idle breakdown
- Frequency, core count, architecture info
- 5-minute usage history chart
GPU Tab 🎮
- GPU usage percentage with progress ring
- Utilization breakdown (Apple Silicon: Device/Renderer/Tiler)
- GPU memory usage
- Model information
- 5-minute usage history chart
Memory Tab 💾
- Usage percentage with progress ring
- Active/Wired/Compressed/Inactive breakdown
- Visual memory bar (color-coded)
- Swap usage (if applicable)
- 5-minute usage history chart
Disk Tab 💿
- Space usage with progress ring
- Read/write speeds (MB/s)
- Dual I/O history charts
- Total data transferred
- Mount point info
Network Tab 🌐
- Upload/download speeds (formatted)
- Dual speed history charts
- Total bytes in/out
- Peak speed indicators
Sensors Tab 🌡️
- Temperature gauges (CPU/GPU/System)
- Temperature status indicator
- Power consumption (Watts)
- Fan speed monitoring
- Manual fan control (Advanced users only!)
- Safety warnings
Settings Configuration
General Settings:
- Update Interval: 0.5-5 seconds (default: 1s)
- Lower = More responsive, higher CPU usage
- Higher = Less responsive, lower CPU usage
- Launch at Login: Auto-start with macOS
- Show in Dock: Display app icon (requires restart)
Menu Bar Settings:
- Show CPU/Memory/Network: Toggle what's displayed
- Icon Style: Percentage (75%) / Icon Only / Graph
Alert Settings:
- Enable Alerts: Toggle notification system
- CPU Threshold: 50-100% (default: 80%)
- Memory Threshold: 70-100% (default: 90%)
- Temperature Threshold: 70-100°C (default: 85°C)
- Alerts have 5-minute cooldown to avoid spam
Data Export
- Click "Export" button in popover footer
- Choose save location
- File format: CSV with headers
- Columns: Timestamp, CPU, GPU, Memory, Disk R/W, Network Up/Down
- Auto-opens in Finder after save
Fan Control ⚠️
WARNING: Manual fan control can damage hardware if used incorrectly!
How to use:
- Go to Sensors tab
- Toggle "Manual" switch for a fan
- Read and accept warning dialog
- Adjust slider to set target RPM
- Monitor temperatures carefully
- Click "Reset All to Auto" or quit app to restore automatic control
Safety Features:
- Warning dialog before enabling manual mode
- Persistent warning banner
- Emergency reset button
- Auto-restore on app quit
- All fans restored to automatic mode on quit
🏗️ Architecture
Technical Stack
- Language: Swift 5.9+
- UI Framework: SwiftUI + AppKit hybrid
- Concurrency: Swift Concurrency (async/await, actors)
- Platform: macOS 14.0+ (Sonoma)
- APIs: IOKit, SMC, Metal, UserNotifications, FileManager
Project Structure
SystemMonitor/ (40 Swift files, 4,448 lines)
├── App/
│ ├── SystemMonitorApp.swift # @main entry point
│ ├── AppDelegate.swift # Menu bar setup, lifecycle
│ └── Info.plist # LSUIElement config
├── Core/
│ ├── Managers/
│ │ ├── MenuBarManager.swift # NSStatusItem + popover
│ │ └── MonitoringManager.swift # Central coordinator (6 actors)
│ ├── Services/ (6 Actors)
│ │ ├── CPUMonitor.swift # CPU metrics
│ │ ├── GPUMonitor.swift # GPU metrics
│ │ ├── MemoryMonitor.swift # Memory metrics
│ │ ├── DiskMonitor.swift # Disk metrics
│ │ ├── NetworkMonitor.swift # Network metrics
│ │ ├── SensorMonitor.swift # Temperature/Fan/Power
│ │ └── FanController.swift # Manual fan control
│ ├── SystemAPIs/
│ │ ├── IOKitBridge.swift # IOKit C API wrapper
│ │ ├── SMCBridge.swift # SMC (undocumented API)
│ │ └── SysctlHelper.swift # sysctl wrapper
│ └── Utils/
│ ├── NotificationManager.swift # Alert system
│ ├── DataExporter.swift # CSV export
│ ├── DataFormatter.swift # Byte/speed formatting
│ └── Logger.swift # Logging utility
├── Models/ (11 Models)
│ ├── SystemMetrics.swift # Main container
│ ├── CPUMetrics.swift # CPU data
│ ├── GPUMetrics.swift # GPU data
│ ├── MemoryMetrics.swift # Memory data
│ ├── DiskMetrics.swift # Disk data
│ ├── NetworkMetrics.swift # Network data
│ ├── SensorMetrics.swift # Sensor data
│ ├── AppSettings.swift # @AppStorage settings
│ ├── HistoricalData.swift # Time-series manager
│ └── CircularBuffer.swift # FIFO buffer
└── Views/
├── Popover/ (6 Metric Views)
│ ├── PopoverContentView.swift # Main container + tabs
│ ├── CPUView.swift
│ ├── GPUView.swift
│ ├── MemoryView.swift
│ ├── DiskView.swift
│ ├── NetworkView.swift
│ └── SensorView.swift
├── Components/ (Reusable)
│ ├── LineChartView.swift # Time-series chart
│ ├── ProgressRingView.swift # Circular progress
│ ├── MetricRowView.swift # Label + value row
│ └── FanSliderView.swift # Fan control slider
└── Settings/ (3 Settings Views)
├── SettingsWindow.swift # TabView container
├── GeneralSettingsView.swift
├── MenuBarSettingsView.swift
└── AlertSettingsView.swift
Key Design Patterns
Actor-based Concurrency:
- Each monitor is an
actorfor thread safety - Prevents data races
- Swift Concurrency best practices
Parallel Data Collection:
await withTaskGroup { group in
group.addTask { CPU }
group.addTask { GPU }
group.addTask { Memory }
group.addTask { Disk }
group.addTask { Network }
group.addTask { Sensors }
}
Memory-Efficient Storage:
- Circular buffer (300 points = 5 min @ 1 sec)
- Fixed memory footprint
- No memory growth over time
Smart Equality:
// Only update if change > threshold
static func == (lhs: CPUMetrics, rhs: CPUMetrics) -> Bool {
abs(lhs.usage - rhs.usage) < 1.0 // <1% change
}
⚠️ Known Issues & Limitations
SMC & Sandbox
- Temperature/Fan features require App Sandbox disabled
- Development: Signing & Capabilities → Remove App Sandbox
- Production: Requires proper entitlements (see BUILD.md)
- Alternative: Run without sandbox restrictions
Hardware Compatibility
- SMC keys vary by hardware:
- M1/M2/M3/M4 use different keys
- Intel Macs use different keys
- Some sensors may not be available
- Fan control:
- Experimental feature
- May not work on all Macs
- Use with extreme caution
Permissions
- UserNotifications: Prompt on first alert
- IOKit: Requires elevated access for some features
- SMC: Requires sandbox disabled
🛠️ Building from Source
See BUILD.md for comprehensive build instructions.
Quick Build:
# Clone repository
git clone https://github.com/ersinkoc/SystemMonitor.git
cd SystemMonitor
# Open in Xcode
open SystemMonitor.xcodeproj
# Or build with SPM
swift build -c release
Requirements:
- macOS 14.0+ (Sonoma)
- Xcode 15.0+
- Swift 5.9+
📄 License
MIT License - See LICENSE file for details.
Copyright (c) 2026 Ersin KOC
🙏 Credits
Created by:
Inspired by:
- iStat Menus - Industry standard
- Stats - Open source alternative
- eul - SwiftUI monitor
SMC Research:
- apple_sensors
- Open source SMC implementations
📞 Support
- Repository: github.com/ersinkoc/SystemMonitor
- Issues: Report a bug
- Discussions: Ask a question
- Author: Ersin KOC | @ersinkoc
Built with ❤️ by Ersin KOC
using Swift, SwiftUI, and modern macOS APIs
⭐ Star this repo if you find it useful!