how to tell which application is using a port on mac terminal code example Example: running ports in mac sudo lsof -PiTCP -sTCP:LISTEN