Find out which ports are used in Mac Os
René Dohmen
September 29, 2020
1 min

Being involved in microservice oriented and or container based application architecture usually implies having a lot of terminals with running processes during app development. Occasionally ports are blocked by a crashed service or port conflicts between docker desktop and local running daemons.

I always forget which commands to run on Mac OS to find out which ports are in use. For Linux it’s something like:

You could use the graphical port scanner, that’s available from the Mac Network Utility program, on or localhost to list the ports but that’s slow and it doesn’t show reliable info about the processes using it.

Mac os Port Scan
Mac os Port Scan

The weird thing is that netstat is actually installed but somehow the command line options differ subtly, like they also do for dd and fdisk. The best readable way I could find:

Example Output

But lsof is faster, better sorted and includes the process names:

Example output:

Hope it helps me and/or others in the future when I need this info again 😎

Related Posts

Deploy FastAPI on Amazon Serverless
May 15, 2021
5 min
© 2021, All Rights Reserved.
Powered by formatics

Quick Links

Advertise with usAbout UsContact Us

Social Media