so despite my numerous attempts at getting Dnsmasq to work, I'm posting here to get some help from the community. Summary: I'm trying to get all .local domains to automatically resolve to localhost or

This is a fresh/clean installation of Sierra on a 2014 MBP 15. I already have Homebrew, Composer, Node, etc installed. Here are the steps I have taken so far following guides from here and here:

  1. brew install dnsmasq
  2. /usr/local/etc already existed when brew was installed, so I nano /usr/local/etc/dnsmasq.conf
  3. Inside this I have:

    address=/local/ no-resolv strict-order

  4. sudo brew services start dnsmasq

  5. sudo mkdir /etc/resolver
  6. sudo nano /etc/resolver/local --> nameserver
  7. I finally restarted my Mac.

Once restarted I opened my zsh terminal, and tried to both ping and dig test.local :

ping -c 2 test.local --> ping: cannot resolve test.local: Unknown host

dig test.local @ --> connection timed out; no servers could be reached

I've tried adding manually to the top of my DNS Servers under Network Preferences. In dnsmasq.conf, I've also tried address=/.local/ (notice '.' in front of 'local' being the difference). Finally I've tried restarting dnsmasq: brew services restart dnsmasq ... unfortunately, none of these helped.

Is there a step I missed or misconfigured?

  • Please do not keep both questions open, as cross posting is not allowed per our FAQ. – Rui F Ribeiro Jun 25 '17 at 16:54
  • Apologies, I'll close the other one – Shalan Jun 25 '17 at 18:04
brew services restart dnsmasq

This command will run with your current user, thus dnsmasq doesn't have the permission to listen on port 53

I suggest to stop that process first

brew services stop dnsmasq

And then restart dnsmasq with root user

sudo brew services restart dnsmasq

Check service status

sudo brew services list

Name           Status  User Plist
dnsmasq        started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Make sure the User is root

  • 1
    NOTE: The brew commands use the word services, not service. I tried to edit this answer, but I didn't have enough characters edited to get over SO's threshold. – rinogo Dec 31 '19 at 17:42
  • 1
    thanks @rinogo, edited – Tommy Nguyen Jan 1 '20 at 23:56
  • Thank you for this, I always forget the sudo and it seems to work without needing sudo, until I then try and ping from the terminal! – Calvin deClaisse-Walford Feb 8 '20 at 17:06

I was running into a similar issue using OSX High Sierra where dnsmasq wasn't working for me. I also noticed this:

$ dnsmasq

dnsmasq: failed to create listening socket for 
Permission denied

So I tried sudo dnsmasq and now all of a sudden, my local domains are working. I have no idea why.

  • 2
    dnsmasq: command not found – Pmpr Dec 15 '17 at 15:21
  • When dnsmasq installed via brew, it runs as a service. If you need to run as a command you need to have /usr/local/sbin in your $PATH, since that's where it's located. – osman Oct 12 '18 at 7:20

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.