how to check which ports are open in macbook pro code example Example: running ports in mac sudo lsof -PiTCP -sTCP:LISTEN