Very occasionally when using my Mac, I notice my internet connection slowing down. Using Activity Monitor I can see that it's because something is downloading data at the full rate my connection can support --- but I don't know how to tell what's responsible for it. It can be caused by several different things (Dropbox syncing; some app doing an automatic update; most recently it was a video buffering in a browser tab that I'd forgotten about) so it'd be really handy to have a way to tell which app is responsible for the network use. Is such a thing possible in OS X? Ideally I'm looking for a free solution. (Command line is OK.) I'm on Snow Leopard if it makes a difference.
|
You can try this
Let it run for a while, then hit Control-C. It will print a summary of the number of bytes read from sockets, distributed among processes. For a more detailed view, replace Disclaimer: I have only tried this on Lion, but AFAIK no great changes in dtrace-ability have occured between SL and Lion. |
|||||||||||||
|
FirewallsYou could use Little Snitch or HandsOff. They are great firewalls and both have a "Network Monitor" feature, that will do the job:
The network monitors of: Little Snitch (left), HandsOff (right) NettopA free and built-in cli solution (unfortunately it is not included in Snow Leopard) would be nettop. nettop groups traffic by program and port and measures various network statistics. OtherThere are few other programs, that capture and measure traffic (iftop, wireshark, tcpdump), but they don't know the originated pid. To make the connection you should use netstat. |
|||||||||
|
will give you all network accesses by all applications (and processes). Usually the process creating a lot of traffic is the one which appears most often in the output. |
|||||
|
|
The "DTrace book" has a script, soconnect.d, that does this. Copy the "Mac OS X" version, paste it in a text file, then run it from the terminal with |
|||||
|

