how to listen to port on mac code example Example 1: running ports in mac sudo lsof -PiTCP -sTCP:LISTEN Example 2: release a port in mac sudo lsof -i :<port>