A native macOS menu bar app to view and kill processes listening on TCP ports.
Built with SwiftUI — no Electron, no web views, no dependencies.
Every developer has been there: port 3000 is already in use.
The usual fix is a cryptic terminal one-liner:
lsof -iTCP:3000 -sTCP:LISTEN | awk 'NR>1 {print $2}' | xargs kill -9Port Killer replaces that with a single click from your menu bar.
- Menu bar app — lives in the system tray, no Dock icon
- Instant scan — lists all TCP listening processes with port, PID, and user
- One-click kill — terminate any process directly (with confirmation for system processes)
- Smart search — filter by process name, port number, or user
- App icons — resolves real application icons from
/Applications - Process descriptions — hover any process to see what it does (FR/EN)
- System process warnings — flags
rootand known macOS services to prevent accidents
Port Killer is a pure SwiftUI app using only Apple frameworks (SwiftUI, AppKit, Foundation).
| Port Killer | Electron-based alternatives | |
|---|---|---|
| App size | ~2 MB | 100+ MB |
| Memory | ~30 MB | 150+ MB |
| Startup | Instant | 2-5 seconds |
| Dependencies | 0 | Node.js + Chromium |
The UI uses native macOS materials (.ultraThinMaterial), SF Symbols, and semantic colors — dark mode, accent colors, and accessibility work automatically.
The app uses standard macOS utilities under the hood. No magic, no hidden binaries:
- Scan — runs
lsof -iTCP -sTCP:LISTEN -n -Pto list listening TCP sockets - Kill — runs
kill -9 <pid>to terminate the selected process - Refresh — re-scans automatically after each kill
All commands are visible in ShellService.swift.
- macOS 14+ (Sonoma)
- Xcode 15+
- Open
PortKiller.xcodeprojin Xcode - Select your signing team
- Disable App Sandbox (required for
lsofandkillto work):- Target → Signing & Capabilities → remove "App Sandbox"
- Build & Run (
⌘R)
Note: The app requires the sandbox to be disabled. Without this, process scanning returns incomplete results and killing processes fails silently.
To hide the Dock icon, add Application is agent (UIElement) = YES in the target's Info tab, or set LSUIElement = true in Info.plist.
PortKiller/
├── PortKillerApp.swift # Entry point — MenuBarExtra setup
├── Models/
│ ├── PortProcess.swift # Process data model + system process detection
│ └── ProcessDescriptions.swift # FR/EN descriptions for 100+ known processes
├── ViewModels/
│ └── PortViewModel.swift # Scan, filter, and kill logic
├── Views/
│ ├── ContentView.swift # Main panel (toolbar, list, status bar)
│ └── ProcessRowView.swift # Individual process row with hover & kill
└── Services/
└── ShellService.swift # Shell commands (lsof, kill) + output parsing
MIT