sudo lsof -PiTCP -sTCP:LISTEN close open ports code example Example 1: release a port in mac sudo lsof -i :<port> Example 2: how to stop a port in macos kill -9 port