Ultra-low power macOS daemon for clamshell operation in backpack
Backpack Mode is a macOS daemon that optimizes your Mac for safe, efficient operation while closed in a backpack. It manages power consumption, thermal output, network connectivity, and keeps you informed via AirDrop notifications to your phone.
┌─────────────────────────────────────────────────────────────┐
│ BACKPACK MODE SCENARIO │
├─────────────────────────────────────────────────────────────┤
│ │
│ [Mac in Backpack] [Your Phone] │
│ ┌─────────────┐ ┌──────────┐ │
│ │ Lid Closed │ ──AirDrop──→│ Status │ │
│ │ Ultra-Low │ Status │ Updates │ │
│ │ Power Mode │ │ Alerts │ │
│ │ Connected │◄─Hotspot───┤ │ │
│ └─────────────┘ WiFi/BT └──────────┘ │
│ │
│ ✓ Runs cool (~40°C max) │
│ ✓ Minimal battery drain │
│ ✓ Always connected (WiFi→Hotspot→BT) │
│ ✓ You know what's happening (AirDrop alerts) │
│ │
└─────────────────────────────────────────────────────────────┘
- CPU throttling: Minimum viable frequency (800MHz base)
- Process optimization: Suspend non-essential daemons
- Active thermal monitoring: Keep CPU temp < 65°C (safe for enclosed space)
- Adaptive performance: Further throttle if temp exceeds threshold
- Battery-aware: Different profiles when on battery vs AC
WiFi (Known Networks)
↓ (disconnect)
Phone Hotspot (WiFi)
↓ (unavailable)
Bluetooth PAN (Personal Area Network)
↓ (last resort)
Bluetooth Beacon (status updates only)
-
AirDrop notifications for:
- ✅ Backpack Mode activated
⚠️ Thermal warning (>60°C)- 🔴 Critical temperature (>70°C)
- 📶 Network status changes
- 🔋 Low battery (<20%)
- ✅ Returning to normal mode
-
Periodic health updates (configurable, default: every 30 min)
- Activates when lid closes (via
pmset -glid state) - Deactivates when lid opens
- Manual control via CLI:
backpack-mode [enable|disable|status]
# Build and install
cd ~/sources/standalone-projects/backpack-mode
make install
# Enable daemon
sudo launchctl load ~/Library/LaunchAgents/com.backpackmode.daemon.plist
# Start manually for testing
./bin/backpack-mode# Check status
backpack-mode status
# Enable manually (useful for testing)
backpack-mode enable
# Disable manually
backpack-mode disable
# View logs
tail -f ~/.backpack-mode/backpack.log
# Configure settings
nano ~/.backpack-mode/config.jsonDefault configuration (~/.backpack-mode/config.json):
{
"thermal": {
"max_temp_c": 65,
"critical_temp_c": 70,
"check_interval_seconds": 10
},
"power": {
"cpu_speed_limit": 800,
"low_power_mode": true,
"disable_non_essential": true
},
"network": {
"fallback_chain": ["wifi", "hotspot", "bluetooth"],
"hotspot_ssid": "YourPhoneHotspot",
"check_interval_seconds": 30
},
"notifications": {
"method": "airdrop",
"phone_name": "YouriPhone",
"health_update_interval_minutes": 30,
"alert_on": ["thermal_warning", "network_change", "low_battery"]
}
}backpack-mode/
├── cmd/
│ └── main.go # Daemon entry point
├── internal/
│ ├── config/ # Configuration management
│ ├── daemon/ # Main daemon orchestrator
│ ├── monitor/ # System monitoring (CPU, thermal, power)
│ ├── network/ # Network fallback chain
│ ├── notify/ # AirDrop notification system
│ └── power/ # Power management (CPU throttling, pmset)
├── scripts/
│ └── install.sh # Installation script
└── com.backpackmode.daemon.plist # Launchd configuration
┌─────────────┐
│ NORMAL │
│ (Lid Open)│
└──────┬──────┘
│ Lid Close
▼
┌─────────────┐
┌───────│ BACKPACK │─────────┐
│ │ MODE │ │
│ └──────┬──────┘ │
│ │ │
│ │ Temp > 65°C │ Network Loss
│ ▼ ▼
│ ┌─────────────┐ ┌──────────┐
│ │ THROTTLE │ │ FALLBACK │
│ │ MODE │ │ CHAIN │
│ └──────┬──────┘ └────┬─────┘
│ │ │
│ │ Temp < 55°C │
│ └──────────────┘
│
└──────────────→ Lid Open → NORMAL MODE
- Uses
pmsetto configure power settings - Uses
powermetricsfor thermal monitoring - Uses
sysctlto manage CPU frequency
- Uses
networksetupfor WiFi management - Uses
blueutilfor Bluetooth management - Implements exponential backoff for reconnection
- Uses
osascript(AppleScript) for AirDrop - Falls back to
terminal-notifierif AirDrop unavailable - Stores notification history in
~/.backpack-mode/notifications.json
- Auto-hibernate: If temp > 75°C for > 5 minutes, force hibernate
- Battery preservation: Hibernates if battery < 10%
- Network timeout: Don't waste battery on failed reconnections
- Watchdog: If daemon crashes, launchd auto-restarts (max 10 crashes/hour)
All activity logged to ~/.backpack-mode/backpack.log with timestamps:
2026-02-07 12:00:00 [INFO] Backpack Mode activated (lid closed)
2026-02-07 12:00:01 [INFO] Thermal: CPU 42°C, Battery 85%, WiFi: Connected
2026-02-07 12:30:00 [INFO] Health update sent via AirDrop
2026-02-07 12:45:23 [WARN] Thermal warning: CPU 62°C, throttling further
- macOS 12+ (Monterey or later)
- Intel or Apple Silicon
- Phone with AirDrop support (iPhone recommended)
- WiFi and Bluetooth enabled
# Run in development mode (verbose logging)
go run cmd/main.go --verbose
# Run tests
go test ./...
# Build release
make buildDaemon not starting:
# Check launchd logs
log stream --predicate 'process == "backpack-mode"' --level debugNetwork not connecting:
# Test manually
backpack-mode network-testNot receiving AirDrop notifications:
- Ensure AirDrop is enabled on both devices
- Check phone name in config:
backpack-mode config get notifications.phone_name - Verify Bluetooth is enabled
MIT
Created for ultra-mobile computing workflows.
Status: 🚧 Active Development | Version: 0.1.0-alpha