how to close a port on mac code example Example 1: how to close a port mac sudo lsof -i :5955 Example 2: how to stop a port in macos kill -9 port