Skip to content

About

Native macOS menu bar app to scan and kill processes listening on TCP ports. Built with SwiftUI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Port Killer

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.

macOS Swift License

Why

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 -9

Port Killer replaces that with a single click from your menu bar.

Features

  • 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 root and known macOS services to prevent accidents

Native & Lightweight

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.

How It Works

The app uses standard macOS utilities under the hood. No magic, no hidden binaries:

  1. Scan — runs lsof -iTCP -sTCP:LISTEN -n -P to list listening TCP sockets
  2. Kill — runs kill -9 <pid> to terminate the selected process
  3. Refresh — re-scans automatically after each kill

All commands are visible in ShellService.swift.

Setup

Requirements

  • macOS 14+ (Sonoma)
  • Xcode 15+

Build & Run

  1. Open PortKiller.xcodeproj in Xcode
  2. Select your signing team
  3. Disable App Sandbox (required for lsof and kill to work):
    • Target → Signing & Capabilities → remove "App Sandbox"
  4. Build & Run (⌘R)

Note: The app requires the sandbox to be disabled. Without this, process scanning returns incomplete results and killing processes fails silently.

Menu bar only (no Dock icon)

To hide the Dock icon, add Application is agent (UIElement) = YES in the target's Info tab, or set LSUIElement = true in Info.plist.

Project Structure

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

License

MIT

About

Native macOS menu bar app to scan and kill processes listening on TCP ports. Built with SwiftUI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages