[Mac] Command to check processes using a specific port: lsof -i

Tadashi Shigeoka ·  Thu, March 27, 2014

A memo on how to use the command lsof -i to check processes using a specific port on Mac.

For example, if you want to check which port mongod is using:

% lsof -i | grep mongod
mongod      365 your_username    9u  IPv4 0xd006e2ded5999795      0t0  TCP localhost:28017 (LISTEN)
mongod      365 your_username   10u  IPv4 0xd006e2deda2a3f7d      0t0  TCP localhost:27017 (LISTEN)

You can see that it’s using port 28017.


Reference Information

lsof - Wikipedia

開いているファイルのプロセスを特定(lsofコマンド) - Qiita

@IT:特定のポートをオープンしているプロセスを調べるには

That’s all from the Gemba.