close TCP ports mac terminal code example Example: close tcp port on mac sudo lsof -i :5955 sudo kill -9 PID