Is there an equivalent tool/shell command for Mac (preferably integrated with the OS) that has the functionality of the Windows command-line netstat -b -n? (displays active network connections, with the application that created them and source/dest IP+Port)

  • OS X has a netstat command that shows all of this. It's called netstat too. – skub Jan 21 '12 at 4:54
up vote 8 down vote accepted

OS X has a netstat command, but it doesn't display information about the programs associated with the network connections. If you want to see that, you need to use lsof instead. Note that it must be run as root (i.e. with sudo) in order to see other users' programs:

sudo lsof -i

lsof also has many options for controlling what's displayed:

sudo lsof -i tcp -nP   # show TCP unly (no UDP), and don't translate IP addrs and ports numbers to names
sudo lsof -i 6tcp -stcp:listen   # show only IPv6 TCP ports in the listen state
sudo lsof -i @   # show only connections to/from

...see the man page for more.

As already been pointed out, netstat is also available on Mac OS X as a command line tool.

If you prefer a GUI tool integrated with the OS, then you can use network utility located here: /Applications/Utilities/Network\

Besides netstat, it allows easy access to other network utilities as well. A good overview on the network utility can be found in the article "How to use Network Utility".

lsof lists open files, so if a process is on last-ack say, they wont be listed

netstat will not give pids on osx

utility does not work as suggested

so no answers are correct

there is no way as far as i can see to duplicate the functioning of cports on the mac

all other answers are misleading

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.