check port mac code example
Example 1: mac terminal find process by port
sudo lsof -i tcp:3000
Example 2: port finding in macos
$ lsof -nP -iTCP -sTCP:LISTEN | grep 8000
Example 3: running ports in mac
sudo lsof -PiTCP -sTCP:LISTEN
sudo lsof -i tcp:3000
$ lsof -nP -iTCP -sTCP:LISTEN | grep 8000
sudo lsof -PiTCP -sTCP:LISTEN