且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从Mac上的终端关闭开放端口?

更新时间:2023-11-28 11:42:04

  1. 找出占用您要释放的端口号(例如5955)的进程ID(PID)

  1. Find out the process ID (PID) which is occupying the port number (e.g., 5955) you would like to free

sudo lsof -i :5955

  • 使用其PID杀死当前正在使用该端口的进程

  • Kill the process which is currently using the port using its PID

    sudo kill -9 PID