Advanced Battery Monitoring for macOS
A beautiful, native macOS application that provides detailed insights into your Mac's battery health, performance, and power consumption.
Features • Installation • Screenshots • Building • Contributing
- Live Updates: Battery information refreshes every 2 seconds
- Accurate Metrics: Direct access to IOKit for precise battery data
- Zero Performance Impact: Lightweight and efficient native Swift implementation
- Battery Level: Large, easy-to-read percentage display with dynamic color gradient
- Charging Status: Clear indication of charging state with visual feedback
- Charging Power: Real-time wattage display when connected to power
- Time to Full Charge: Estimated charging time remaining
- Battery Health: Quick health percentage at a glance
- Cycle Count: Total charge-discharge cycles
Complete battery specifications organized into intuitive sections:
Capacity Metrics
- Current Capacity (mAh)
- Maximum Capacity (mAh)
- Design Capacity (mAh)
- Current Battery Level (%)
Electrical Metrics
- Voltage (V)
- Amperage (mA)
- Power Draw/Wattage (W)
Health & Lifecycle
- Battery Health Percentage
- Cycle Count
- Temperature (°C)
Power Source
- Charging Status
- Power Source Type
- Time to Full Charge
Educational content explaining:
- What each metric means
- How to interpret the data
- Battery care tips and best practices
- Optimal battery maintenance guidelines
- Pure SwiftUI: Modern, native macOS design language
- Dynamic Colors: Adaptive color schemes based on battery state
- Smooth Animations: Fluid transitions and progress indicators
- Dark Mode Support: Full support for light and dark appearances
- Responsive Layout: Optimized for various window sizes
Add screenshots here showing the three tabs in action
- Go to the Releases page
- Download the latest
PowerID.dmgorPowerID.zip - For DMG:
- Open the DMG file
- Drag PowerID to your Applications folder
- Eject the DMG
- For ZIP:
- Unzip the archive
- Move PowerID.app to Applications
- Launch PowerID from your Applications folder
Since the app is unsigned, macOS will prevent it from opening the first time:
- Go to System Settings > Privacy & Security
- Scroll down to find the security message about PowerID
- Click "Open Anyway"
- Confirm you want to open the app
See the Building from Source section below.
- macOS 15.7 or later
- Xcode 16.2 or later
- Swift 5.0+
- Command Line Tools for Xcode
-
Clone the repository
git clone https://github.com/yourusername/powerid.git cd powerid -
Generate app icons (optional, icons may already exist)
chmod +x generate_icon.swift ./generate_icon.swift
-
Open in Xcode
open PowerID.xcodeproj
-
Build and Run
- Select the "PowerID" scheme
- Choose your Mac as the destination
- Press
⌘Rto build and run - Or press
⌘Bto build only
xcodebuild clean build \
-project PowerID.xcodeproj \
-scheme PowerID \
-configuration Release \
-derivedDataPath buildThe built app will be located at:
build/Build/Products/Release/PowerID.app
PowerID/
├── PowerID.xcodeproj/ # Xcode project configuration
├── PowerID/ # Source code
│ ├── PowerIDApp.swift # App entry point and settings
│ ├── ContentView.swift # Main UI and all views
│ ├── BatteryMonitor.swift # Battery monitoring logic
│ └── Assets.xcassets/ # App icons and assets
├── generate_icon.swift # Icon generation script
├── .github/
│ └── workflows/
│ └── build-release.yml # Automated build and release
├── README.md # This file
└── RELEASE.md # Release process documentation
The core battery monitoring engine that:
- Interfaces with IOKit to access battery information
- Uses IOPSCopyPowerSourcesInfo for power source data
- Queries IOKit registry for detailed battery metrics
- Publishes updates via Combine framework
- Implements efficient 2-second polling
Key APIs Used:
IOPSCopyPowerSourcesInfo(): Power source informationIOServiceGetMatchingService(): AppleSmartBattery service accessIORegistryEntryCreateCFProperty(): Registry property queries
SwiftUI views organized into:
- OverviewView: Primary dashboard with key metrics
- DetailsView: Comprehensive battery specifications
- HistoryView: Educational information and tips
- Supporting custom views:
StatusCard,DetailSection,InfoSection
Application lifecycle and settings:
- Window configuration (disabled full-screen)
- Settings interface with preferences
- App delegate for macOS integration
- Menu commands and keyboard shortcuts
Automated icon generation:
- Creates all required icon sizes (16x16 to 1024x1024)
- Generates beautiful gradient backgrounds
- Embeds SF Symbol (bolt.fill)
- Outputs PNG files for all resolutions
PowerID is built using pure SwiftUI and native macOS APIs. No third-party dependencies, no Electron, no web views—just fast, native code that feels at home on macOS.
The three-tab interface progressively discloses information:
- Overview: Quick glance at critical metrics
- Details: Comprehensive specifications for power users
- Info: Educational content for understanding the data
- Color-coded battery states (red/orange for low, green for healthy)
- Smooth animations for state changes
- Dynamic gradients that reflect battery status
- Clear iconography using SF Symbols
- Efficient IOKit queries minimize system impact
- 2-second update interval balances freshness with efficiency
- Compiled Swift code for maximum performance
- Minimal memory footprint
| Metric | Description | Source |
|---|---|---|
| Battery Level | Current charge as % of max capacity | IOPowerSources API |
| Current Capacity | Actual charge in mAh | IOKit Registry |
| Max Capacity | Current full charge capacity | IOKit Registry |
| Design Capacity | Original factory capacity | IOKit Registry |
| Battery Health | (Max / Design) × 100% | Calculated |
| Cycle Count | Total charge-discharge cycles | IOKit Registry |
| Voltage | Battery voltage in volts | IOKit Registry |
| Amperage | Current flow in milliamps | IOKit Registry |
| Wattage | Power (V × A) / 1000 | Calculated |
| Temperature | Battery temp in Celsius | IOKit Registry |
- Operating System: macOS 15.7 or later
- Architecture: Apple Silicon or Intel
- Hardware: Mac with battery (not compatible with Mac mini, Mac Studio, Mac Pro)
- Permissions: No special permissions required
PowerID runs in the App Sandbox with:
ENABLE_APP_SANDBOX = YESENABLE_USER_SELECTED_FILES = readonly- IOKit access for battery information (allowed in sandbox)
Contributions are welcome! Here's how you can help:
- Use the Issues page
- Include macOS version, Mac model, and steps to reproduce
- Screenshots are helpful!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Swift style conventions
- Maintain SwiftUI best practices
- Keep the native macOS feel
- Test on both Intel and Apple Silicon if possible
- Update documentation for new features
- Menu bar mode with quick stats
- Battery health notifications
- Historical battery data tracking
- Export battery reports
- Widget support
- Localization for other languages
- Battery usage predictions
- Comparison with similar Mac models
PowerID uses GitHub Actions for automated builds and releases.
# Create a version tag
git tag -a v1.0.0 -m "Release version 1.0.0"
# Push the tag
git push origin v1.0.0GitHub Actions will automatically:
- Build the app
- Generate app icons
- Create DMG and ZIP distributions
- Publish a GitHub release
See RELEASE.md for detailed release instructions.
Problem: macOS blocks the app with "cannot be opened because it is from an unidentified developer"
Solution:
- Go to System Settings > Privacy & Security
- Find the message about PowerID
- Click "Open Anyway"
Problem: All values show as 0 or "Unknown"
Solution:
- Ensure you're running on a Mac with a battery
- Check Console.app for error messages from PowerID
- Try restarting the app
Problem: "File not found" or missing assets
Solution:
- Run
./generate_icon.swiftto create icons - Clean build folder: Product > Clean Build Folder (
⌘⇧K) - Restart Xcode
Problem: generate_icon.swift fails to create icons
Solution:
chmod +x generate_icon.swift
./generate_icon.swiftVerify the output path exists:
ls -la PowerID/Assets.xcassets/AppIcon.appiconset/This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2026 PowerID Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Built with SwiftUI
- Icons use SF Symbols
- Inspired by the need for detailed battery information on macOS
- Thanks to the macOS developer community
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Website: jpalenchar.me
Made with ⚡ and ❤️ for the Mac community