7

How do I install ss on OS X? I couldn't find the iproute package in homebrew.

Red Hat recommends ss over netstat in Red Hat Enterprise Linux 7. ss is provided by the iproute package.

Red Hat Docs

bmike
  • 235,889
Sybil
  • 3,937
  • 14
  • 48
  • 81
  • 6
    If you don't get a good answer for your needs - please edit the question to describe the function you need ss to perform. There is likely a tool on OS X that ships natively to get you what you actually need. – bmike Feb 28 '15 at 15:52
  • 1
    Is there a reason you can't use netstat for your purpose? It comes with OS X as far as I know. – Tom Gewecke Feb 28 '15 at 18:47
  • Given that ifconfig is deprecated and will be removed from most Linux distribution defaults, it makes sense that someone would want the ip commands to enforce good habits. brew install iproute2mac as suggested at https://superuser.com/a/898971/457084 gets you closer – Ben Creasy Jul 30 '17 at 16:43

3 Answers3

2

It's possible to use lsof to obtain most information provided by ss e.g. This command will list network connections (-i), showing IP addresses and omitting any DNS lookups (-n) and showing TCP/TPI info:

lsof -i -n  -Tf

Also netstat provides similar info.

Pierz
  • 3,647
1

ss is not ported to macos right now as far as I now. (It is also not inclided https://github.com/brona/iproute2mac -> see issue #20 for details: https://github.com/brona/iproute2mac/issues/20)

But I think you can still use netstat on macOS or what feature is missing there ?

  • 2
    The netstat command has been deprecated for at least 10 years by now (as well as ifconfig for example). They were developed by BSD for their IP stack a few tens of years ago, anything new is missing in them. See for example https://unix.stackexchange.com/a/387406/ – Paolo42 May 09 '21 at 19:21
  • 3
    @Paolo42 That information is unfortunately incorrect. On Linux (and Linux only) the iproute2 package contains several utilities that are intended to replace utilities such as ifconfig and netstat. This is not so on macOS and other Unix variants. Also it is not "developed by BSD" - the netstat command on macOS is not the same as the netstat command in the original BSD (which is 25+ years old). – jksoegaard Aug 08 '21 at 21:09
-2

In order to get ss, you would need to get the source code for iproute. Since you mention Red Hat linux, go onto a linux machine running Red Hat, and run the following command:

sudo yum source iproute

Now, copy over the source code to your Mac, and compile it.

You could also go on the Red Hat packages site and get the source tarball.

Note: I have not tested this, but this is the normal way to get source code.

Spotlight
  • 1,548
  • 14
  • 19
  • 2
    To whoever downvoted this, why? – Spotlight Feb 28 '15 at 15:51
  • 8
    Most likely this won't work. iproute2 relies on functionality in the Linux kernel. There is https://github.com/brona/iproute2mac but it's not clear if that will get you ss. – Ben Creasy Jul 30 '17 at 16:31
  • Also see https://superuser.com/a/898971/457084 – Ben Creasy Jul 30 '17 at 16:39
  • 5
    the author is asking for ss alternatives in Mac - not redhat – jeffery.yuan Dec 20 '17 at 21:44
  • See: https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/misc/ss.c which includes numerous #include <linux/....> Also see brew list iproute2mac, which contains only theiptool, notss`. Don't have rep to down-vote, but would have done so: this is an Apple stackexchange site, OP merely quotes a red hat web site, and, even if they had asked about red hat, the answer still is not relevant to this audience. – Jack Wasey Oct 01 '20 at 07:23