Show open ports on Mac

If you want to know which ports are open on your Mac, you can use built-in tools in terminal:

lsof -i -P | grep -i "listen"

This gives you a list with all applications and their open ports:

launchd      1           root    7u  IPv6 0xddffe8ef3a82ead1      0t0  TCP *:5900 (LISTEN)
launchd      1           root    8u  IPv4 0xddffe8ef3a836869      0t0  TCP *:5900 (LISTEN)
launchd      1           root   11u  IPv6 0xddffe8ef3a82e4b1      0t0  TCP *:22 (LISTEN)
launchd      1           root   14u  IPv6 0xddffe8ef3a82e4b1      0t0  TCP *:22 (LISTEN)
launchd      1           root   18u  IPv4 0xddffe8ef3a835ea1      0t0  TCP *:22 (LISTEN)
launchd      1           root   22u  IPv4 0xddffe8ef3a835ea1      0t0  TCP *:22 (LISTEN)
launchd      1           root   26u  IPv6 0xddffe8ef3a82ead1      0t0  TCP *:5900 (LISTEN)
launchd      1           root   28u  IPv4 0xddffe8ef3a836869      0t0  TCP *:5900 (LISTEN)
kdc        182           root    5u  IPv6 0xddffe8ef3a82de91      0t0  TCP *:88 (LISTEN)
kdc        182           root    7u  IPv4 0xddffe8ef3a837bf9      0t0  TCP *:88 (LISTEN)
rapportd   389          peter    4u  IPv4 0xddffe8ef405bfea1      0t0  TCP *:51350 (LISTEN)
rapportd   389          peter    5u  IPv6 0xddffe8ef3a82c611      0t0  TCP *:51350 (LISTEN)
ARDAgent   412          peter    9u  IPv6 0xddffe8ef3a82f0f1      0t0  TCP *:3283 (LISTEN)
syncthing  484          peter   19u  IPv6 0xddffe8ef490b6ff1      0t0  TCP *:22000 (LISTEN)
syncthing  484          peter   25u  IPv4 0xddffe8ef4861ace1      0t0  TCP localhost:8384 (LISTEN)
Enpass     513          peter   21u  IPv4 0xddffe8ef46e39149      0t0  TCP localhost:10391 (LISTEN)