Last Updated: February 25, 2016
· shinn

Find out which application occupying a port in OSX

Sometimes during Rails development, I will force the unresponsive server to stop by doing control + z which could caused the server to occupy the 3000 port in the background.

Without having to restart the machine, we can use

lsof -i tcp:3000

which represents List Open Files. Then, find out the pid and kill it with SIGKILL.

kill -9 [pid]