A macOS system tray application for monitoring and managing processes running on specific ports. Features real-time port monitoring, process management with an intuitive GUI, and flexible configuration options.
- Real-time Port Monitoring: Continuously scans specified port ranges for active processes
- System Tray Integration: Clean, native macOS status bar icon with live indicators
- Instant Notifications: Visual indicators when processes start/stop on monitored ports
- Lightweight: Minimal system resource usage with efficient scanning algorithms
- Dedicated Management Interface: Separate GUI for advanced process management
- Smart Process Detection: Identifies Node.js, Bun, Deno, Python, and other server types
- Advanced Filtering:
- Text search across commands, ports, PIDs, and process types
- Option to hide .sock entries and system processes
- Real-time filter updates
- Bulk Operations:
- Select All checkbox for filtered results
- Kill multiple selected processes at once
- Selective process termination with safety controls
- Lightning-Fast Scanning: Sub-second port range scanning using optimized
lsofcommands
- Flexible Port Ranges: Configure any port range (e.g., 3000-3020, 1025-65000)
- Multiple Interfaces: Command-line arguments, configuration files, and GUI configuration
- Live Configuration Updates: Changes apply immediately without restart
The application consists of three main components:
- Port Monitor Tray (
port-monitor-tray): Main system tray application - Configuration GUI (
port-monitor-config-gui): Settings management interface - Process Management GUI (
port-monitor-process-gui): Advanced process control interface
- Rust: Install via rustup.rs
- macOS: 10.15+ recommended
- Xcode Command Line Tools:
xcode-select --install
# Clone the repository
git clone <repository-url>
cd PortMonitoringApp
# Build all binaries (release mode for optimal performance)
cargo build --release
# Or build individual components:
cargo build --release --bin port-monitor-tray
cargo build --release --bin port-monitor-config-gui
cargo build --release --bin port-monitor-process-gui# Start the main tray application
./target/release/port-monitor-tray
# Open configuration GUI
./target/release/port-monitor-config-gui
# Open process management GUI
./target/release/port-monitor-process-gui# Use the provided build script
chmod +x build_app.sh
./build_app.sh
# The app bundle will be created at: ./PortMonitor.app
# Move to Applications folder:
mv PortMonitor.app /Applications/- Launch: Run
port-monitor-trayor launch from Applications folder - Status Indicators:
- π’ Green dot: Processes detected on monitored ports
- β« Black dot: No processes detected
- Menu Options:
- View current process list
- Open Configuration GUI
- Open Process Management GUI
- Quit application
- Port Range: Set start and end ports for monitoring
- Poll Interval: Configure how often to check for processes (in seconds)
- Real-time Preview: See current processes as you adjust settings
- Save/Load: Automatic configuration persistence
- Process List: View all processes listening on monitored ports
- Search & Filter:
- Search by command, port, PID, or process type
- Toggle to hide .sock entries
- Real-time filtering updates
- Bulk Selection:
- Individual checkboxes for each process
- "Select All" for filtered results
- Actions:
- Refresh: Rescan for current processes
- Kill Selected: Terminate chosen processes
- Close Window: Exit GUI
~/.config/port-monitor/config.toml
[port_range]
start = 3000
end = 3020
poll_interval_seconds = 2Development Setup (Common dev ports):
[port_range]
start = 3000
end = 3020
poll_interval_seconds = 2Full Range Monitoring (Catch services like Playwright):
[port_range]
start = 1025
end = 65000
poll_interval_seconds = 5High-Frequency Monitoring:
[port_range]
start = 8000
end = 8100
poll_interval_seconds = 1# Set port range
./target/release/port-monitor-tray --start-port 3000 --end-port 3020
# Set polling interval
./target/release/port-monitor-tray --poll-interval 5
# Combined options
./target/release/port-monitor-tray --start-port 1025 --end-port 65000 --poll-interval 3- Fast Scanning: Uses
lsof -b -n -i:PORT_RANGE -sTCP:LISTENfor sub-second scans - Efficient Parsing: Optimized port and process parsing with service name resolution
- Minimal Resource Usage: Event-driven architecture with configurable polling intervals
The application detects and categorizes:
- Node.js processes (including npm, pnpm, bun dev servers)
- Bun runtime processes
- Deno applications
- Python servers (including Django, Flask)
- Unknown processes (with full command display)
- Selective Termination: Only kill explicitly selected processes
- System Process Protection: Filters out critical system processes
- Confirmation Required: Visual feedback for all termination actions
- Error Handling: Graceful failure handling with user notifications
"No processes found" despite running services:
- Ensure processes are listening on TCP ports (not UDP)
- Check that port range includes your process ports
- Verify processes are actually bound to network interfaces
Permission errors when killing processes:
- Some processes require elevated permissions
- Run with
sudoif needed for system processes - Check process ownership matches current user
GUI windows not appearing:
- Windows may appear behind other applications
- Check Activity Monitor for running processes
- Try closing and reopening the GUI
Enable detailed logging:
RUST_LOG=debug ./target/release/port-monitor-traysrc/
βββ main.rs # Main tray application entry point
βββ tray.rs # System tray integration and menu handling
βββ monitor.rs # Port scanning and process detection
βββ config.rs # Configuration management
βββ config_gui.rs # Configuration GUI application
βββ process_gui.rs # Process management GUI
βββ terminator.rs # Process termination utilities
βββ types.rs # Shared data structures
- tray-icon: macOS system tray integration
- eframe/egui: GUI framework for configuration and process management
- crossbeam-channel: Thread-safe communication
- serde/toml: Configuration serialization
- anyhow: Error handling
- New Process Types: Extend
ServerTypeenum inprocess_gui.rs - Additional Filters: Add filter logic in
ProcessGuiApp::filtered_processes() - Configuration Options: Update
Configstruct inconfig.rs
MIT License - see LICENSE file for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Make your changes
- Add tests if applicable
- Submit a pull request
- Follow Rust naming conventions
- Add error handling for all system calls
- Update README for user-facing changes
- Test on macOS 10.15+ before submitting