How to find a port in use by a process with lsof
lsof -i tcp:3000
An alternative option is to use
netstat
netstat -vanp tcp | grep 3000
Quickly kill the port with
kill -i $(lsof -ti:3000)
For multiple ports you can use
kill -9 $(lsof -ti:3000,3001)
References:
- https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac