Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is anybody else not able to get nc -lp 8888 working on Mac OS X? Is there another way to get this to work?

share|improve this question
How does it not work? Does it return an error? – heavyd Mar 3 '10 at 1:58
I am not near a mac right now, but it returns the useage. nc -lp 8888 works on my Ubuntu box. – kzh Mar 3 '10 at 15:50
up vote 18 down vote accepted

It looks to me as if the -p option does nothing on the OS X version of netcat. To get it to work, I must do nc -l localhost 8888.

share|improve this answer
Unless installed from homebrew, then nc -l -p 8888 works. – user1338062 Dec 3 '12 at 13:27
From man nc: -l ... It is an error to use this option in conjunction with the -p, -s, or -z options. ... You probably want to just stick with @kzh's command there – fatuhoku Oct 11 '13 at 18:41
@fatuhoku I just checked my manual, and yest it does say that in there, but the weird thing is that if I do nc -lp 8888 or nc -l -p 8888 it will then take -p to mean listening port. So my distributed copy does not listen to its own manual! – kzh Oct 11 '13 at 20:31
Agreed! Flags are a bit too expressive... it should have just refused to do any useful work, output a message and quit! – fatuhoku Oct 11 '13 at 21:02
Works also with nc -l 8888 – polym Jun 19 '15 at 10:49

Here's how this is working for me on OS X 10.10, with either the installed BSD version, or the one from Homebrew:

BSD Version

When using the BSD version that ships with OS X, a server can be started like this

/usr/bin/nc -l 9999


  • Install using Homebrew: brew install netcat
  • This will install v0.7.1 of
  • One can use either the nc or netcat command. nc is an alias for netcat.

To start a server:

nc -l -p 9999

To start a client:

nc targethost 9999

To get the manpage of this version, one needs to use man netcat, as man nc will open the manpage of the BSD version.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .