Charging Protection
Automatically sleeps your Mac when battery reaches 75% (customizable) to prevent overcharging damage and extend battery lifespan.
Intelligent mac battery monitoring tool that automatically prevents overcharging and deep discharge. Keep your MacBook battery healthy with smart automation.
Advanced battery monitor for Mac with automated protection and smart sleep counters
Automatically sleeps your Mac when battery reaches 75% (customizable) to prevent overcharging damage and extend battery lifespan.
Protects against battery damage by automatically sleeping when charge drops below 25% (customizable threshold).
Forces sleep 3 times, then switches to gentle reminders. Auto-resets when battery returns to optimal range.
Beautiful macOS notifications with sound alerts. Wake-up dialogs show detailed sleep statistics and battery info.
Configured as launchd service to start automatically on boot. Runs silently in background with minimal resource usage.
Complete logs of battery events, sleep times, and statistics for tracking battery health trends over time.
Get your mac battery monitor running in less than a minute with our automated installer
Clone the repository and run the installer:
git clone https://github.com/ninadingAI/battery-monitor.git
cd battery-monitor
chmod +x install.sh
./install.sh
One-line install with curl:
# 方法1: 从GitHub Pages下载 (需要启用Pages)
curl -fsSL https://ninadingAI.github.io/macbatterymonitor.com/battery-monitor-install.sh -o install.sh && chmod +x install.sh && ./install.sh
# 方法2: 从GitHub Raw下载 (立即可用)
curl -fsSL https://raw.githubusercontent.com/ninadingAI/macbatterymonitor.com/main/battery-monitor-install.sh -o install.sh && chmod +x install.sh && ./install.sh
Or download the installer script directly:
Download installer (install.sh)cd ~/Downloadschmod +x battery-monitor-install.sh./battery-monitor-install.sh💡 提示:安装过程中会要求输入密码来配置系统服务
Adjust battery thresholds to match your usage patterns
Sleep when battery reaches this level while charging
Sleep when battery drops below this level
After this many sleeps, only show reminders
chmod +x battery_monitor_custom.sh && ./battery_monitor_custom.sh
💡 Tip: The downloaded script is pre-configured with your settings. Just make it executable and run!
Watch how the smart battery monitor protects your MacBook automatically
Automatic Detection
Monitors battery level every 30 seconds in the background
Smart Notifications
Shows native macOS notifications with detailed information
Gentle Sleep
Protects battery by putting Mac to sleep when needed
Experience the battery monitoring dashboard with real-time data
Step-by-step guide to get your battery monitor running
Copy and paste this command in Terminal:
curl -fsSL https://raw.githubusercontent.com/ninadingAI/macbatterymonitor.com/main/battery-monitor-install.sh -o install.sh && chmod +x install.sh && ./install.sh
✅ What it does:
If you prefer to download manually:
Download the script
Click the download button above to get battery-monitor-install.sh
Open Terminal
Press ⌘ + Space, type "Terminal", press Enter
Navigate to Downloads
Type: cd ~/Downloads
Make executable & run
Type: chmod +x battery-monitor-install.sh && ./battery-monitor-install.sh
The tool runs in the background and monitors your battery every 30 seconds
Get native macOS notifications when battery needs attention
Starts automatically when you boot your Mac
Understanding the smart sleep counter mechanism
When battery ≥ 75%
First 3 times: Forces sleep with notification "Sleep (Attempt X/3)"
After 3 sleeps
Shows reminder only: "Consider unplugging your charger"
Auto-reset
Counter resets when battery drops below 75%
When battery ≤ 25%
First 3 times: Forces sleep to protect battery
After 3 sleeps
Shows reminder only: "Consider connecting your charger"
Auto-reset
Counter resets when battery charges above 25%
Common commands for managing the battery monitor service
launchctl list | grep battery
launchctl unload ~/Library/LaunchAgents/com.user.battery.monitor.plist
launchctl load ~/Library/LaunchAgents/com.user.battery.monitor.plist
tail -f ~/battery_monitor/battery_monitor.log
./uninstall.sh
Completely removes the service and all related files
Everything you need to know about Battery Monitor
The new version (v2.0) implements a smart counting mechanism. It will force sleep only 3 times for each scenario (high battery or low battery). After that, it will only send notification reminders without forcing sleep. This prevents infinite interruptions to your workflow.
Edit the MAX_SLEEP_TIMES variable in ~/battery_monitor/battery_monitor.sh. You can set it to any value from 1 to 10. After changing, restart the service with launchctl unload and launchctl load.
Check if the plist file is correctly placed in ~/Library/LaunchAgents/ and that the username in the file paths has been properly replaced. You can verify the service status with launchctl list | grep battery. If needed, run the installer again.
The counter resets automatically when your battery returns to a normal range (below 75% for high battery, or above 25% for low battery). If you want to manually reset it, delete the counter file: rm ~/.battery_sleep_counter
Yes, completely safe. The tool uses macOS native commands (pmset) and system notifications. It doesn't modify any system files or require administrator privileges beyond normal sleep commands. The purpose is to protect your battery from damage caused by prolonged overcharging or deep discharge.
Yes, run launchctl unload ~/Library/LaunchAgents/com.user.battery.monitor.plist to stop the service. To re-enable it, run launchctl load ~/Library/LaunchAgents/com.user.battery.monitor.plist
Join hundreds of Mac users managing their mac battery health with intelligent automation