If you get an error like Fatal error: Port 9000 is already in use by another process when trying to run a service on a specific port in Mac OS, you can find and free it.


Run process


inanzzz@inanzzz:/api$ grunt serve
[I 150813 16:22:39 server:271] Serving on http://127.0.0.1:9000

[Fatal error: Port 9000 is already in use by another process.

Find and kill process


inanzzz@inanzzz:/api$ sudo lsof -i :9000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 96591 inanzzz 23u IPv4 0xb14fc16f2d205b65 0t0 TCP localhost:cslistener (LISTEN)

inanzzz@inanzzz:/api$ sudo kill -9 96591

Check it


inanzzz@inanzzz:/api$ sudo lsof -i :9000