handleman
12/5/2016 - 1:20 PM

How do I close an open port from the terminal on the Mac?

How do I close an open port from the terminal on the Mac?

#Find out the process ID (PID) which is occupying the port number (e.g., 5955) you would like to free
sudo lsof -i :5955
#Kill the process which is currently using the port using its PID
sudo kill -9 PID