The Computer Oracle

Netcat on Mac OS X

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Dreamlands

--

Chapters
00:00 Netcat On Mac Os X
00:11 Accepted Answer Score 65
00:27 Answer 2 Score 27
01:15 Answer 3 Score 12
01:27 Answer 4 Score 10
01:43 Answer 5 Score 1
02:14 Thank you

--

Full question
https://superuser.com/questions/115553/n...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #netcat

#avk47



ACCEPTED ANSWER

Score 65


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.




ANSWER 2

Score 27


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

Homebrew

  • Install using Homebrew: brew install netcat
  • This will install v0.7.1 of http://netcat.sourceforge.net/
  • 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.




ANSWER 3

Score 12


I needed to test a web service over SSL, which ncat (made by the nmap team) supports.

brew install nmap
ncat -C --ssl api.somecompany.com 443

https://nmap.org/ncat/




ANSWER 4

Score 10


nc on MacOS has too many bugs, and Apple did none patch for years. the netcat from homebrew is a very low version. use ncat from nmap instead




ANSWER 5

Score 1


Based on the nc manual from Mac:

NC(1) General Commands Manual NAME nc – arbitrary TCP and UDP connections and listens

-l      Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote
             host. 

It is an error to use this option in conjunction with the -p, -s, or -z options. Additionally, any timeouts specified with the -w option are ignored.

Working example:

nc -lv 9001