Skip to content

MacOS Check localhost ports in use

By Jasper Frumau

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)