What’s running on port 8787 on my Mac?
8787 is where wrangler dev runs your Cloudflare Worker locally. With several Workers in a monorepo, they all reach for it at once.
Updated
Commonly used by
- Wrangler (Cloudflare Workers)
wrangler devserves your Worker on localhost:8787. - Wrangler Pages
wrangler pages devuses 8788, right next door. - RStudio ServerUses 8787 for its web IDE, usually via a Docker image on a Mac.
Check what’s on port 8787
lsof -nP -iTCP:8787 -sTCP:LISTEN
ps -o pid,etime,command -p <PID>
You’ll usually see two processes: node running Wrangler, and workerd, the Workers runtime it spawns. Either way, the working folder tells you which Worker:
lsof -a -p <PID> -d cwd -Fn | tail -1
With Stat Space: statspace port 8787.
Free it
Press x or Ctrl-C in the Wrangler terminal. From elsewhere, kill the node process; it takes workerd down with it. If workerd survives on its own (it can after a crash), kill it too:
pkill -f workerd
Only do that if no other Wrangler session should be running.
Change the port
One-off:
npx wrangler dev --port 8790
Permanently, in wrangler.jsonc:
{
"dev": {
"port": 8790
}
}
Or in wrangler.toml:
[dev]
port = 8790
If 8787 is busy, current Wrangler versions pick a free port on their own and print it, so check the terminal output for the URL. For Pages projects, the same --port flag works on wrangler pages dev.
Who can reach it
wrangler dev binds to localhost. --ip 0.0.0.0 (or "ip": "0.0.0.0" under dev) makes it reachable from your network. Your local Worker sees your .dev.vars secrets and local D1, KV and R2 data, so an exposed dev Worker can leak both. Keep the default unless you’re testing from a phone. See dev server exposed to the network.
Seeing it live
Stat Space lists 8787 with the Worker’s project folder, the launcher that started it and its uptime, next to the Vite or Next.js frontend it usually pairs with.
Questions
How do I run two Workers locally at once?
Give each its own port with wrangler dev --port 8788, or set dev.port in each wrangler config. For Workers that call each other, wrangler dev -c a/wrangler.jsonc -c b/wrangler.jsonc runs them in one session.
What's the second port Wrangler opens?
Wrangler also opens an inspector port for DevTools debugging (9229 by default). Change it with --inspector-port if it clashes with a Node debugger.
Does wrangler dev talk to Cloudflare?
By default it runs your Worker locally in workerd. With --remote it runs on Cloudflare's network, but the local proxy still listens on 8787.
Know what your Mac is doing, without adding to it.
Free, no account. Pro is $9.99 once for the first 100 buyers.