how to kill a service based on port number on mac code example
Example: how to kill a service based on port number on mac
lsof -P | grep ':PortNumber' | awk '{print $2}' | xargs kill -9
lsof -P | grep ':PortNumber' | awk '{print $2}' | xargs kill -9