how to check which port mac uses code example
Example 1: port finding in macos
$ lsof -nP -iTCP -sTCP:LISTEN | grep 8000
Example 2: running ports in mac
sudo lsof -PiTCP -sTCP:LISTEN
$ lsof -nP -iTCP -sTCP:LISTEN | grep 8000
sudo lsof -PiTCP -sTCP:LISTEN