I am on mac ElCapitan 10.11.6 (15G31) and running simple rack application rackup -p 5004. I can connect to it with http://localhost:5004/ and http://[::1]:5004/

But can't connect with and

This looks like mis-configuration on my machine. I get different errors when try to connect with IPv4 and IPv6.

$ nc -v -4 5004 # and nc -v -4 5004 and nc -v -4 localhost 5004
nc: connectx to port 5004 (tcp) failed: Connection refused

$ nc -v -6 5004 # and nc -v -6 5004
nc: getaddrinfo: nodename nor servname provided, or not known

But I can connect with nc -v -6 localhost 5004

My hosts file is pretty simple:

$ cat /etc/hosts                                                                                                                                                     localhost broadcasthost
::1             localhost

I need to make it work with my host machine IP address so I can connect within Docker container. How to fix this?

Additional information I found on different topics

  • scutil

    $ scutil -r
    Reachable, Local Address, Directly Reachable Address
    $ scutil -r
    Reachable, Local Address, Directly Reachable Address
    $ scutil -r localhost
    $ scutil -r ::1
    Reachable, Local Address, Directly Reachable Address
    # but note, ???
    $ scutil -r qwerty
  • lsof port usage

lsof shows port is by ruby executable and the interesting part is localhost:avt-profile-1. Checking what avt-profile-1 is gives results for "Real-time Transport Protocol media data". More info here. Also interesting is when I stop the rackup application there is no port usage, so this is not service/daemon running on my machine.

lsof -i :5004
ruby    12167 kode   16u  IPv6 0xf3c39e30b59c5321      0t0  TCP localhost:avt-profile-1 (LISTEN)

Here I have different application running on port 5000. It's reachable via the host IP at Note the NAME *:commplex-main. Addittionaly I would like to know what this is used for.

lsof -i :5000
ruby    12889 kode   14u  IPv4 0xf3c39e30b22fcbe9      0t0  TCP *:commplex-main (LISTEN)
  • host address name

    host has no PTR record
  • arp

    $ arp
    ? ( at a0:99:9b:17:16:1d on en0 ifscope permanent [ethernet]
  • nslookup

    $ nslookup localhost
    Name:   localhost
    $ nslookup
    Address:  name = localhost.
    $ nslookup
    ** server can't find NXDOMAIN

The issue was rackup runs on localhost by default. To use host one must specify it with -o like rackup -o -p 5004. Only one host can be specified.


Ah, I had that same issue a while back. It turned out to be a bad script Chrome was executing. I solved the problem by using Safari instead.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • This seems to be not my case. It's the same in Safari and Opera. @chromaticsyllabus did you isolate which script was running? – kode Aug 3 '16 at 18:48
  • For some reason nsIQTScriptablePlugin.xpt (ordinarily a Safari plugin you should keep running, see support.apple.com/en-us/HT203353) was being hijacked by Chrome. If you check Chrome's task manager you may be able to see this. Not sure if Opera has something similar. – chromaticsyllabus Aug 3 '16 at 18:52
  • I have the plugin too $ locate nsIQTScriptablePlugin.xpt/Library/Internet Plug-Ins/Disabled Plug-Ins/nsIQTScriptablePlugin.xpt $ file /Library/Internet\ Plug-Ins/Disabled\ Plug-Ins/nsIQTScriptablePlugin.xpt /Library/Internet Plug-Ins/Disabled Plug-Ins/nsIQTScriptablePlugin.xpt: XPConnect Typelib version 1.1 – kode Aug 3 '16 at 18:56
  • I don't see this plugin in chrome://plugins/ running about:plugins in Chrome address bar. Had 4 other plugins. Disabling them doesn't solve the issue. – kode Aug 3 '16 at 19:03
  • Welcome to Ask Different. We like answers to be more than just a single line. Ideally, you want to explain why your answer is *right." It also helps to provide links, citations, and/or screen shots. Please review our help section How to Answer on writing good answers to questions – Allan Aug 4 '16 at 11:51

You must log in to answer this question.

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