MacOS How to see which process is listening on a port.

How to check ports in use Linux & MacOS

Sometime when trying to start server processes you may get a message to say that the port is already in use. So how do you work out what is using the port and how do you fix it?

To see which process is using the port use this command:

sudo lsof -nP -iTCP:5000 | grep LISTEN

In this case we’re looking for what is using port 5000. If anything is using the port you will see something like this:

Python  78500 bob    5u  IPv4 0xdd33030855f89bcb      0t0  TCP (LISTEN)

This is saying that Python is listening in port 5000 on a process with the id, 78500.

Once you have the process ID you can kill it using the command:

kill 78500

You May Also Like…

Twitter client for Mac #Twitter

Twitter client for Mac #Twitter

The official Twitter client for the Mac died yesterday. When you try and start it now it fails to authenticate any of...

Find similar blogs in these categories: Apple MacOS / OSX | Linux
Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.