Yolk

You start the server and it tells you port 3000 is taken. By whom? By you, nearly always: something you left running days ago in a terminal that no longer exists.

I love the terminal; it’s where I spend my day. But nobody types a command to find out what time it is: you glance up and that’s it. Yolk is that for ports, little more than a glance at the menu bar.

What it is

A small native app that lives in the macOS menu bar. No main window, no Dock icon, no third-party dependencies. Click it and there’s everything your Mac has listening locally, named and accounted for.

Each row says just enough that you don’t have to ask anything else: port, name, the command that started it and how long it’s been running. If the process lives in a folder with a package.json, the name comes from there, looking up to three folders up; if there isn’t one, the folder’s name will do. It’s all sorted into collapsible groups: development, databases, apps, system and a junk drawer for the rest.

It used to be called Port Dog. Same dog, new collar.

How it knows what it knows

This is the part I had the most fun with, so bear with me for a moment in the workshop.

The easy way would have been to run the usual command under the hood and chop up its output. Half the world does it. It’s brittle, it’s slow and it ties you to the format of text meant for human eyes.

Yolk asks the system directly, through libproc, with a tiny C shim that translates its structures. And it asks for very little: only TCP sockets in the listening state, and only on home addresses. Good old 127.0.0.0/8, IPv6’s ::1, IPv4 addresses dressed up as IPv6 and wildcard addresses, which answer locally too. Left out are UDP, established connections and anything bound exclusively to a network IP.

Then it merges. The same service often listens on IPv4 and IPv6 at once, and you couldn’t care less: it’s one row, not two.

What you do with it

Look, first of all. It sounds like nothing, and it’s ninety percent of the point.

Second, keep your hands on the keyboard. Type and the list filters itself; the arrows pick; Return opens it in the browser; ⌘C copies the address. And ⌘⌫ stops whichever one you’ve selected.

Stopping deserves a couple of lines, because it’s where an app like this can do real damage.

First it asks nicely: a SIGTERM, which roughly means pack up and go. If two seconds later the process is still there playing dumb, then, and only after you confirm, out comes the SIGKILL. And before sending either, Yolk checks who owns the process and when it was born. Why? Because process IDs get recycled: the number that was your orphaned server a minute ago may now be something else entirely, guilty of nothing. Killing the neighbour over a reused number is the kind of failure people remember.

Is it foolproof? No. There’s an instant between checking and firing, and the system offers no way to do both in one move. It’s as close as you can get, and I’d rather tell you.

The rest are the kind of details you only miss when they’re gone:

What it doesn’t do

This mattered to me as much as the rest. A tool that pokes around your processes has to earn your trust through its limits.

It doesn’t ask for admin rights. It sees what macOS lets your user see, and that’s it.

To put a face on each service it looks for an icon: the app’s, if there is one, the project’s favicon in the usual folders and, failing that, it asks the server. That server, on that port, over that protocol; nobody else. It doesn’t follow redirects elsewhere, it sends no cookies or credentials, every response is capped in size and time, and SVGs only get in if they carry no scripts or third-party resources. What it finds, and what it doesn’t, it keeps for ten minutes, so it isn’t knocking on the door every three seconds.

And if there’s no icon to be had? Initials, and move on.

Nor is it a mind reader. Working out which project a process belongs to takes a bit of nose, and in a convoluted monorepo it can lose the scent.

What it’s made of

SwiftUI and MenuBarExtra, macOS 13 and up. The list refreshes every three seconds even with the panel closed, and you can set it to two, five or ten.

The settings live inside the panel itself: light, dark or whatever the system says, a solid or translucent background and four palettes, from the formal one to the one you wouldn’t take to a wedding.

There are 49 automated tests. The ones that touch processes spin up their own sockets and their own throwaway processes, because testing an app that kills servers on yours would be a creative way to lose friends.

And one detail I’m sillily proud of: when you collapse a group or filter, the panel changes height without its top edge moving. You won’t notice. That’s the point.

MIT licence.

The fine print

It’s on 1.4 and still in beta. Two practical consequences.

One: it isn’t notarized by Apple, so macOS will frown the first time you open it. It isn’t sandboxed either, and not out of laziness: a sandboxed app can’t inspect or stop other people’s processes, which is exactly its job.

Two: the build includes Intel, but I haven’t yet tested it on a flesh-and-blood Intel Mac the way it deserves.

If you still want to know who took your 3000, now you know where to look.

← Back to index