What’s running on port 4200 on my Mac?
Port 4200 means Angular, or occasionally Ember. When ng serve says the port is taken, it’s almost always another Angular app you forgot to stop.
Updated
Commonly used by
- Angular CLI
ng serve(andnpm startin Angular projects) serves on localhost:4200. - Nx Angular apps
nx serveuses the same Angular dev server and default port. - Ember CLI
ember servealso defaults to 4200.
Check what’s on port 4200
lsof -nP -iTCP:4200 -sTCP:LISTEN
It will be node. To see which project, check its folder:
lsof -a -p <PID> -d cwd -Fn | tail -1
With Stat Space: statspace port 4200.
Free it
kill <PID>
ng serve handles SIGTERM and exits cleanly. If you started it in a terminal that’s still open, Ctrl-C there is simplest.
Change the port
For a one-off run:
ng serve --port 4201
To make it the project default, set it in angular.json under your app’s serve target:
"serve": {
"builder": "@angular/build:dev-server",
"options": {
"port": 4201
}
}
Older projects use @angular-devkit/build-angular:dev-server as the builder; the port option is the same. For Ember, use ember serve --port 4201 or set "port": 4201 in .ember-cli.
Note that ng serve also opens a live-reload WebSocket on the same port, so changing it in one place is enough.
Who can reach it
ng serve binds to localhost by default, which is the safe choice. It only becomes reachable from other devices when you pass --host 0.0.0.0. Angular then prints a warning that the dev server is not meant for public access, and it means it: no auth, source maps included. See dev server exposed to the network.
Seeing it live
Stat Space lists 4200 with the project folder and the launcher behind it (Terminal, VS Code, Cursor, an AI agent) plus its uptime. If it was started with --host 0.0.0.0, the row carries an exposure warning.
Questions
How do I run two Angular apps at the same time?
Give the second one its own port: ng serve --port 4201. Recent Angular CLI versions will also offer to use a different port when 4200 is busy.
How do I open ng serve on my phone?
Run ng serve --host 0.0.0.0 and open http://<your-Mac-IP>:4200 on the phone. Stop it when you're done, because anyone on the network can load it.
Why is 4200 in use after I closed VS Code?
An ng serve started from a VS Code task or terminal can keep running if the editor was quit without stopping it. Find it with lsof and kill <PID>.
Know what your Mac is doing, without adding to it.
Free, no account. Pro is $9.99 once for the first 100 buyers.