terminate process running on port mac code example Example 1: kill port mac kill -9 <PID> Example 2: release a port in mac sudo lsof -i :<port>