A production-ready, modular system monitoring application built with Electron that runs in your macOS menu bar. PortPilot provides real-time monitoring of network ports and memory usage with an intuitive, user-friendly interface.
DOWNLOAD IT HERE - https://dub.sh/DEkjFNR
final.mov
- Real-time detection of all active TCP listening ports
- User-friendly descriptions instead of raw process names
- Process identification with PID and service type
- One-click process termination for any port
- Total system memory usage display
- Used vs. available memory breakdown
- Top memory consumers with usage percentages
- Process memory management with kill functionality
- Menu bar integration - no window needed
- Contextual menus with rich information
- Template icons for both light and dark themes
- Graceful error handling with fallbacks
PortPilot uses a clean, modular architecture for maintainability and extensibility:
portpilot/
βββ src/ # Main application code
β βββ main.js # Application coordinator
β βββ utils/ # Specialized modules
β βββ system-info.js # Port & memory detection
β βββ process-manager.js # Process operations
β βββ tray-manager.js # UI and menu management
βββ port-mapping.js # Port-to-service descriptions
βββ assets/ # Icons and resources
βββ main.js # Root entry point
βββ package.json
βββ preload.js
βββ README.md
- Initializes Electron app
- Sets up IPC communication
- Manages application lifecycle
- Coordinates all utility modules
getPortsData()
- Detects active ports usinglsof
getMemoryData()
- Memory usage with system totalssh()
- Safe system command execution
killProcess()
- Terminate processes by PIDkillPort()
- Kill all processes on a portkillPid()
- IPC handler for renderer communication
createTray()
- Creates system tray iconupdateTrayMenu()
- Dynamic menu updatesaddViewData()
- Context-aware menu content
- Maps port numbers to natural language descriptions
- Extensible for new services and protocols
- Fallback to process names for unknown ports
- macOS (optimized for macOS menu bar)
- Node.js (for development)
- sudo access (for process management)
# Clone and navigate
git clone <repository-url>
cd portpilot
# Install dependencies
npm install
# Start the application
npm start
The app will appear in your menu bar (top-right on macOS). Click the orange circle icon to access all features.
- Shows all active TCP listening ports
- User-friendly descriptions (e.g., "Web Development Server" for port 3000)
- Process information with PID and service type
- Kill processes directly from the menu
- System memory overview (Used/Total with percentage)
- Top memory consumers sorted by usage
- Process details with memory usage and percentage
- Memory management with one-click process termination
- View Toggle - Switch between Ports and Memory views
- Refresh - Update data without closing menu
- Kill Process - Terminate any listed process
- Quit - Exit the application
- Primary: Regular
lsof
command - Fallback:
sudo lsof
for root processes - Combining: Merges results from both approaches
- Deduplication: Removes duplicate entries
- Process scanning using
ps
command - System memory detection via
system_profiler
- Real-time calculations of usage percentages
- Top consumers sorted by memory usage
- Graceful termination (SIGTERM)
- Force termination (SIGKILL) for unresponsive processes
- Sudo fallback for system processes
- Error handling with user feedback
- 16x16 pixel bitmap for optimal tray display
- Template image for macOS theme integration
- Orange circle design for visibility
- Transparent background for proper rendering
Edit port-mapping.js
:
const PORT_DESCRIPTIONS = {
// Add new mappings
9000: 'Custom Service Name',
// ... existing mappings
};
- New modules go in
src/utils/
- Import in
src/main.js
- Add IPC handlers for renderer communication
- Update menu in
tray-manager.js
# Manual testing
npm start
# Check for common issues
# - Port 3000 detection
# - Memory calculations
# - Process killing
# - Menu switching
- Sudo access required for process management
- System command execution with proper error handling
- Process isolation using Electron's security model
- No external network access (local system only)
- Check Console.app for errors
- Verify Electron installation
- Restart the application
- Ensure
lsof
command is available - Check sudo permissions
- Verify processes are actually running
- Confirm
ps
andsystem_profiler
access - Check for permission restrictions
- Verify system memory detection
- Check sudo configuration
- Verify process ownership
- Confirm signal handling
- Lightweight - Minimal system resource usage
- Efficient - Cached data with manual refresh
- Responsive - Sub-second menu updates
- Memory efficient - Proper cleanup and garbage collection
- Fork the repository
- Create a feature branch
- Add your improvements
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
PortPilot - Your friendly neighborhood system monitor π₯οΈβ¨