MACOS 下面没有netstat -anp的解决办法
sudo lsof -nP -i
On macOS High Sierra and later, use this command:
sudo lsof -nP -iTCP:$PORT | grep LISTEN
or to just see just IPv4:
sudo lsof -nP -i4TCP:$PORT | grep LISTEN
On older versions, use one of the following forms:
sudo lsof -nP -iTCP:$PORT | grep LISTEN
sudo lsof -nP -i:$PORT | grep LISTEN