Find and kill process locking a port on Mac

This error was caused when I tried to locally run a server on a port that was already being used by another server that I had previously left running and forgot to turn off.

This command will show you all the process(es) running on a port and their PIDs

sudo lsof -i :3000

Kill the process by replacing <PID> with the process’ PID number

kill -9 <PID>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s