I have a service running on localhost on MacOS High Sierra.

curl foo.test 

does not work, but

curl localhost 


To get to my setup, I installed dns using homebrew,

brew install dnsmasq

added my configuration to /usr/local/etc/dnsmasq.conf,


and added a resolver file /etc/resolver/test:


I've spent a day trying

  • dig foo.test
  • scutil --dns
  • dscacheutil -q host -a name foo.test

and nothing worked.

My eventual issue was not covered anywhere else, so I'm answering it here for someone else.

  • same problem on Mojave/10.14.6
    – febeling
    Sep 6, 2019 at 12:32

1 Answer 1


tl;dr make sure you start dnsmasq as root.

To diagnose this problem, I used Console.app, and searched for dnsmasq.

  1. My first problem revealed in the logs:

    failed to create listening socket for Address already in use
    FAILED to start up

To fix this, make sure dnsmasq is stopped:

brew services stop dnsmasq

then use Activity Monitor.app to kill any old dnsmasq processes.

After the socket conflict was removed, I attempted to start dnsmasq again:

brew services start dnsmasq # does not work

and now the logs in Console.app show

failed to create listening socket for Permission denied
FAILED to start up

To fix this, I restarted the service as root:

brew services stop dnsmasq
sudo brew services start dnsmasq


curl foo.test


After this journey, I revisited all those dnsmasq help articles I read. The sudo was there all along and I skimmed over it. I'm posting this for the next person that forgets to start dnsmasq as root.

  • Wouldn't it be the job of the .plist launchd configuration in ~/Library/LaunchAgents to declare as which user this server should run?
    – febeling
    Sep 6, 2019 at 12:34
  • Sounds like a security risk, but the answer here talks about a solution that uses /Library/LaunchDaemons instead.
    – ebelisle
    Sep 11, 2019 at 3:24
  • it only works if you use elevated privileges, so why would using the feature that launchd provide for doing that be security risk?
    – febeling
    Sep 11, 2019 at 10:47
  • It sounds like a security risk because you're granting root permissions to a configuration. As to whether it actually is a security risk, I leave that as an exercise for the reader.
    – ebelisle
    Sep 12, 2019 at 19:03

You must log in to answer this question.

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