A local port management CLI for macOS, Linux, and Windows.
pip install portsmithOr install from source:
git clone <repo>
cd portsmith
pip install -e .Show all listening ports with PID, process name, port, protocol, and status. System ports (<1024) are highlighted in yellow, user ports in green.
portsmith list
# Only show ports opened from this terminal session
portsmith list --mine
# Machine-readable JSON output
portsmith list --json
--minenote: this flag filters to processes running under your OS user account. It removes system services (svchost, lsass, etc.) but will still show other user-owned background apps that happen to listen on ports (e.g. Chrome, cloud sync clients). It correctly catches dev servers started in any shell or terminal window.
Kill the process listening on a given port. Asks for confirmation unless --force is passed.
portsmith kill 8080
# Skip confirmation
portsmith kill 8080 --force
portsmith kill 8080 -fLive-updating view of all active ports, refreshing every 2 seconds. New ports are highlighted green, closed ports red. Exit with Ctrl+C.
portsmith watch
# Only watch ports opened from this terminal session
portsmith watch --mineSave a snapshot of all currently active user ports (port ≥1024) to ~/.portsmith/profiles/<name>.json.
portsmith save myproject
portsmith save dev-stackCheck a saved profile against currently running ports. Shows which saved processes are still running and which are missing, along with hints for restarting them.
portsmith restore myprojectList all saved profiles with their creation timestamp and port count.
portsmith profiles- Python 3.10+
- macOS, Linux, or Windows
- Ports below 1024 are system ports and may require
sudoto kill. portsmith restoredoes not restart processes — it only reports their status and suggests what needs to be restarted.- Profiles are stored in
~/.portsmith/profiles/as JSON files.