A lightweight macOS application that monitors system memory usage and displays real-time memory pressure information in the menu bar.
- Continuous monitoring of system memory usage
- Real-time memory pressure status detection
- Automatic updates with configurable intervals
- Low system resource consumption
- Percentage: Shows memory usage as a percentage
- Absolute Values: Displays used/total memory in GB
- Combined: Shows both percentage and absolute values
- Color-coded status indicators for quick assessment
- Customizable update intervals (1s, 2s, 5s, 10s)
- Adjustable memory pressure thresholds
- Menu bar icon visibility control
- Launch at login option
- Notification preferences
- Automatic alerts when memory usage exceeds thresholds
- Customizable critical memory threshold (default: 90%)
- Non-intrusive notification system
- Option to disable notifications
- Persistent settings using macOS UserDefaults
- JSON configuration export/import
- Easy backup and restore of preferences
- Cross-device configuration sharing
- English
- Chinese (Simplified)
- Russian
- French
- German
- Real-time language switching
- macOS: 13.0 (Ventura) or later
- Swift: 5.9 or later
- Xcode: 15.0 or later (for development)
- Clone the repository:
git clone https://github.com/yourusername/memory-pressure.git
cd memory-pressure- Build the project:
swift build- Run the application:
swift run# Build release version
swift build -c release
# Copy executable to Applications
cp .build/release/MemoryPressure /Applications/
# Or create symbolic link
ln -s $(pwd)/.build/release/MemoryPressure /usr/local/bin/memory-pressure# Make build script executable
chmod +x build_app.sh
# Build application bundle
./build_app.sh
# The app will be created in the dist/ directory
open "dist/Memory Pressure.app"- Launch the application - it will appear in the macOS menu bar
- Click the menu bar icon to view detailed memory information
- Select "Settings" to open the configuration window
- Customize the display format, update interval, and other preferences
The menu bar icon shows memory status with color-coded indicators:
- π’ Normal (Green): Memory usage is normal
- π‘ Warning (Yellow): Memory usage is elevated, consider closing unnecessary apps
- π΄ Critical (Red): Memory usage is high, may affect system performance
- π Danger (Purple): Memory usage is extremely high, system may become unresponsive
- Memory Information: Displays detailed memory usage statistics
- Refresh: Manually refresh memory information
- Settings: Open configuration window
- Quit: Exit the application
- Fast (1s): For precise monitoring scenarios
- Normal (2s): Default setting, balances performance and accuracy
- Slow (5s): Conserves system resources
- Very Slow (10s): Minimal resource consumption
- Percentage: Shows memory usage as a percentage (e.g., "85%")
- Absolute: Shows used/total memory in GB (e.g., "12.8/16.0 GB")
- Percentage + Absolute: Shows both formats (e.g., "85% (12.8/16.0 GB)")
- Show Menu Bar Icon: Control menu bar icon visibility
- Launch at Login: Set application to start automatically at login
- Show Memory Pressure Notifications: Enable/disable memory warning notifications
- Critical Memory Threshold: Customize the threshold for critical memory alerts (default: 90%)
The application uses macOS UserDefaults for configuration storage and supports JSON configuration export/import.
{
"updateInterval": 2.0,
"displayFormat": "percentage",
"showMenuBarIcon": true,
"launchAtLogin": false,
"showNotifications": true,
"criticalMemoryThreshold": 0.90,
"language": "en"
}| Option | Type | Default | Description |
|---|---|---|---|
updateInterval |
Number | 2.0 | Update frequency in seconds |
displayFormat |
String | "percentage" | Display format: "percentage", "absolute", or "both" |
showMenuBarIcon |
Boolean | true | Show/hide menu bar icon |
launchAtLogin |
Boolean | false | Launch application at system startup |
showNotifications |
Boolean | true | Enable memory pressure notifications |
criticalMemoryThreshold |
Number | 0.90 | Critical memory threshold (0.0-1.0) |
language |
String | "en" | Interface language code |
- Verify macOS version meets requirements (13.0+)
- Ensure sufficient permissions to run the application
- Check Console.app for error messages
- Try rebuilding the application
- Try manually refreshing memory information
- Restart the application
- Check for conflicting memory monitoring tools
- Verify system integrity with Disk Utility
- Check System Preferences > Notifications
- Ensure the application has notification permissions
- Verify memory threshold settings are reasonable
- Check "Do Not Disturb" settings
- Increase update interval to reduce CPU usage
- Disable notifications if not needed
- Check for memory leaks in Console.app
- Consider restarting the application
Sources/MemoryPressure/
βββ main.swift # Application entry point
βββ AppDelegate.swift # Application delegate
βββ StatusBarController.swift # Menu bar controller
βββ MemoryMonitor.swift # Memory monitoring core
βββ ConfigurationManager.swift # Configuration management
βββ SettingsWindowController.swift # Settings window controller
βββ LocalizationManager.swift # Multi-language support
- MemoryMonitor: Retrieves system memory information and pressure status
- StatusBarController: Manages menu bar display and user interactions
- ConfigurationManager: Handles user preferences and settings
- SettingsWindowController: Provides graphical settings interface
- LocalizationManager: Manages multi-language support
-
Prerequisites:
- Xcode 15.0 or later
- macOS 13.0 or later
- Swift 5.9 or later
-
Clone and Build:
git clone https://github.com/yourusername/memory-pressure.git cd memory-pressure swift build -
Run Tests:
swift test -
Create Release Build:
swift build -c release
We welcome contributions! Please follow these guidelines:
- 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
To add new functionality:
- Add new configuration options in
ConfigurationManager - Update the settings UI in
SettingsWindowController - Implement the feature logic in the appropriate component
- Add localization strings for all supported languages
- Update documentation and tests
class MemoryMonitor {
func getCurrentMemoryUsage() -> MemoryInfo
func getMemoryPressure() -> MemoryPressureLevel
func startMonitoring(interval: TimeInterval)
func stopMonitoring()
}class ConfigurationManager {
func loadConfiguration() -> Configuration
func saveConfiguration(_ config: Configuration)
func exportConfiguration() -> Data
func importConfiguration(from data: Data)
}This project is licensed under the MIT License. See the LICENSE file for details.
- Built with Swift and AppKit
- Uses macOS system APIs for memory monitoring
- Inspired by various system monitoring tools
- Thanks to all contributors and users
If you encounter any issues or have questions:
- Check the Troubleshooting section
- Search existing Issues
- Create a new issue with detailed information
- Join our community discussions
- Initial release
- Basic memory monitoring functionality
- Menu bar display with color-coded status
- Configurable update intervals and display formats
- Settings window with comprehensive options
- Multi-language support (5 languages)
- Notification system for memory alerts
- Configuration export/import
- Launch at login support
Memory Pressure Monitor - Keep your Mac running smoothly with real-time memory monitoring.