Skip to content
All work
Case study · 06

lsp

Every port in use on your Mac, and what's behind it.

View on GitHubOpen source · on npm · macOS
Status
Open source
Context
Personal project
My role
Product, design & engineering
Category
Developer tools
Year
2026
lsp in a terminal: 22 ports and 5 projects, with Dropwave's web, docs and API servers grouped together, then Ticket2PR, this portfolio, Revo and its mock GitHub server, Chatwave, PostgreSQL 16 and Redis, each with its framework, process id, uptime, CPU, memory and whether the network can reach it. Below, the selected server's folder, its network address and the command it was started with.

Developer tools · macOS terminal · npm · 2026

lsp lists every listening port on a Mac, named after the project and the framework behind it, and refreshes the list every two seconds. One key opens a port in the browser, stops it, restarts it or shows its live logs, without leaving the terminal. It is published on npm as @yaserrar/lsp.

The story

How I built it

My role
Product, design & engineering
Context
Personal project

The problem

[01]

“Address already in use :::3000.” Which project is on port 3000? Is yesterday's dev server still running? Which of the six node processes is using 2 GB? lsof shows process ids and executable names, not projects, and stopping one process often leaves the rest of the dev server running.

What I built

[02]

lsp answers in one screen. It reads the ports and processes the system already knows about, finds the project and framework behind each one, and groups a project's ports together. From there, one key opens a port in the browser, stops it, restarts it or shows its logs, and n shows the address and a QR code for a phone on the same network. Apps and macOS's own ports stay hidden until you ask for them.

Key decisions

[03]
  1. Read the system, nothing more

    Ports come from lsof and processes from ps. There is no daemon to install, no native code and no background service, and nothing leaves the Mac.

  2. Named after the project, not the process

    The project is found from the process's working folder, walking up to the nearest package.json, go.mod, Cargo.toml or pyproject.toml, then named after its git repository. The framework comes from the command line first, then the project's dependencies, then the runtime. Dependencies only count for JavaScript runtimes, so a Python server in a JavaScript repository isn't labelled Next.js.

  3. Stop the whole dev server, never the terminal

    Stop climbs the process tree to the dev server's root, such as npm run dev, and stops everything under it: SIGTERM, then SIGKILL after a four-second grace period. It never stops lsp itself or the terminal it runs in. Homebrew services go through brew services, and Docker containers through docker stop.

  4. Logs a terminal can't read

    One terminal can't read another terminal's output, so lsp run wraps a dev server: its output still shows as usual, a copy goes to ~/.lsp/logs, and the exact command is recorded. That is what makes live logs and restart possible.

  5. No flicker

    Ink's incremental rendering redraws only the lines that changed, and the frame is kept one row shorter than the terminal, because a frame that fills it makes Ink clear the whole screen on every keypress.

The result

  • 49Frameworks, runtimes and services it recognises
  • 0Daemons or native code: only lsof and ps
  • 52Automated tests
Screens

The real product

Screenshots of lsp on my Mac, with some of the projects on this page running. Open any of them full size.

  • [01]Stopping a dev server: the whole tree, or only one process.

  • [02]Ticket2PR stopped, with every process it started.

  • [03]Live logs for a server started with lsp run.

Features

What it does

I build tools developers reach for every day: reading the operating system with lsof and ps, stopping process trees safely, and a terminal interface that stays steady, tested and published on npm.

[01]

Knows your projects

Each port is named after its git repository and folder, like revo › apps/web, and a project's ports are grouped together.

[02]

Knows the stack

49 frameworks, runtimes and services, from Next.js, Vite and NestJS to Django, Rails, PostgreSQL, Redis and Docker containers.

[03]

One key for each action

o opens a port in the browser, k stops it, R restarts it and l shows its live logs. / filters the list, and s sorts it by port, memory, CPU or uptime.

[04]

On your phone

n shows the address other devices on your network can open, with a QR code to scan.

[05]

Spots trouble

Dev servers running for more than three days, folders that no longer exist and memory over 1 GB stand out in yellow, and memory over 2 GB in red.

[06]

Stays out of the way

Your projects come first. VS Code, Figma, AirPlay and macOS's own ports stay hidden until you press a.

Built with

The stack

A TypeScript command-line app with React 19 and Ink 8 for the terminal interface, bundled into one file by tsdown, tested with Vitest, and published on npm.

  • TypeScript
  • React
  • Node.js

Hiring? Let's talk.

Tell me about the role and the team. I reply within one business day.