how to get process id in mac on port 80 code example Example: netstat listening port 8080 mac lsof -nP -iTCP:$PORT | grep LISTEN