Find and kill the dev server Claude Code or Codex left running
On a Mac, lsof -iTCP -sTCP:LISTEN lists every listening port and its process, but not which agent session started it. If a coding agent starts a dev server with nohup and then exits, the server keeps holding its port. ACTVT knows every listening port and which agent session opened it, and when that session has ended it marks the port Orphaned. You can kill it from ACTVT, or the agent can do it over MCP. macOS’s own processes are protected, so they can’t be killed this way.
3:428 chapters
Step by step
0:00Claude starts the dev server
I’m in a fresh terminal in a demo storefront project, with ACTVT open behind it. I ask Claude Code to start the dev server with nohup, so it keeps running after Claude quits.
0:27ACTVT shows who owns the port
With the server up, I open ACTVT’s Monitor tab. Port 3000 is there, and ACTVT knows which Claude Code session started it.
0:39Quit Claude
Now I quit Claude, and the server is still running. ACTVT looks for leftover ports about once a minute.
0:46ACTVT marks it Orphaned
Within a minute, ACTVT sees that the session that opened port 3000 is gone while the port is still open, so the Monitor tab marks the process Orphaned.
1:03Kill it from the Monitor tab
You can kill the process right there in the Monitor tab. There’s a short countdown first, in case you change your mind.
1:11Or ask Claude to clean up
Say you forget about it, and later your app won’t start because port 3000 is taken. Open a new Claude session and ask what’s on that port. Claude asks before it uses ACTVT’s ports tool, and ACTVT tells it which session started the server. That session is gone, so Claude asks if it can kill the server. ACTVT kills it and then checks the port again. Port 3000 is free now, and it’s gone from ACTVT’s list.
2:05macOS’s own processes are protected
Port 5000 is different. The API wants it, but macOS’s AirPlay Receiver is using it. When I ask Claude to use ACTVT there too, Claude asks to run ACTVT’s kill tool on ControlCenter, and ACTVT refuses. The port stays in use, and Claude explains how to free it properly instead. The Monitor tab marks it Protected and tells you why.
2:54Done for the day
Back in the terminal, the dev server starts now without a port conflict. When you’re done for the day, you can stop it from ACTVT as well. This time I let the countdown run out, and the server stops.
Questions
- Can it kill macOS’s own processes?
- No, those are protected.
- Can the agent clean up after itself?
- Yes, over ACTVT’s MCP.
More tutorials
All tutorials →
1:24Every machine you code on
See Claude Code, Codex and pi sessions from all your machines over SSH
Start Claude Code on another Mac over SSH, and you can follow the session from your own Mac while it runs and read the whole transcript when it’s done.
0:48A plan-aware agent
Check your Claude and Codex plan limits before a long agent job
Before a two-hour job, Claude Code asks ACTVT how much of your plan is left. You can see the same limits in ACTVT, along with when each one resets.
2:14Agent or machine?
Was Codex slow, or was it my Mac?
A Codex build felt slow. Claude asks ACTVT what the Mac was doing during that session and gets an answer with the numbers behind it.
Try it on your own agents
ACTVT is free to start, and reads the session files Claude Code, Codex CLI and Pi already write. Nothing to configure.