Is there a terminal command or something on OSX that I can use to test if I can reach some ports on a remote server?

I know these ports are reachable on that server, because I can access them from another computer on another network but what I need is a way to test from another computer, if I can reach that ports, in this case 110 and 25 (POP and SMTP), from a specific computer and if possible a trace or something that can be done to see what is causing the blockage.


You can see if the server accepts a connection on the port by running telnet HOSTNAME PORT or nc HOSTNAME PORT. If the server is listening, the connection will be established, you'll see the banner sent by the server if any, and you'll be able to type commands. If the server isn't listening or if a firewall is blocking the way, nc or telnet will not be able to initiate the connection and you'll get an error message (except with some overly quiet versions of nc (netcat), I don't know about the one on OSX).

To diagnose a firewall, you can use traceroute -P tcp -p 25 to see how far packets to port 25 get. The last reached host is the one before the firewall.


telnet and netcat are our friends. With netcat having the advantage that it works with UDP, too.

  • there is no netcat on OSX. Telnet to port 110? the server is not prepared to accept that. Server is CentOS 6.3. – SpaceDog May 14 '13 at 22:44
  • 1
    @DigitalRobot What is "the server is not prepared to accept that" supposed to mean? It is not possible to make precise connection tests with closed ports. – Hauke Laging May 14 '13 at 22:47
  • @DigitalRobot Netcat is present, the executable is nc. – Gilles 'SO- stop being evil' May 14 '13 at 22:49
  • nope. nc not present. – SpaceDog May 14 '13 at 22:51
  • I'm seeing several places (mostly other SE sites) where people on OS X are complaining that the version that comes with OS X is old. So I'm willing to bet it's there somewhere or there's an option to install it somewhere. – Bratchley May 14 '13 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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