mac 查看端口占用

1.查看端口被哪个程序占用 sudo lsof -i tcp:port

如: sudo lsof -i tcp:8082

2.看到进程的 PID,可以将进程杀死。

sudo kill -9 PID
1