MacOS Check localhost ports in use

To quickly see on your Mac why your Redis cannot be connected to or why Docker cannot run localhost because port 80 is taken you can use the following on MacOS

sudo lsof -iTCP -sTCP:LISTEN -n -P

To quickly check just a port use

sudo lsof -i ':80'

or check Redis port and see its host do

sudo lsof -i ':6379'  
COMMAND    PID         USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
redis-ser 5032 jasperfrumau    6u  IPv4 0xd5d308d04c18512f      0t0  TCP localhost:6379 (LISTEN)
redis-ser 5032 jasperfrumau    7u  IPv6 0xd5d308d9e6010627      0t0  TCP localhost:6379 (LISTEN)
Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.