I installed dnsmasq using brew, and tried to run it as a service without success. This is how I installed it:

brew install dnsmasq
sudo brew services start dnsmasq

system.log just shows 2 lines over and over:

dnsmasq[52260]: setting --bind-interfaces option because of OS limitations
com.apple.xpc.launchd[1] (homebrew.mxcl.dnsmasq): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

I tried running it manually, and I got similar results:

itsadok@mpb ~$ /usr/local/sbin/dnsmasq -d --interface=lo0 --port=50003                                                                                                                              [2.2.4]
dnsmasq: started, version 2.76 cachesize 150
dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack no-ipset auth no-DNSSEC loop-detect no-inotify
dnsmasq: setting --bind-interfaces option because of OS limitations
dnsmasq: reading /etc/resolv.conf
dnsmasq: using nameserver
[1]    53009 abort      /usr/local/sbin/dnsmasq -d --interface=lo0 --port=50003

The exit status is 134, which is consistent with the abort message I'm seeing. Adding sudo does not help.

If I set the port number to 0, effectively disabling DNS, then the process runs indefinitely, but obviously with doing much of anything.

Any idea what's going on, or how I can debug this further?

I'm on Mac OS Sierra, 10.12.4

  • Just tried. It did not help. And I'm running it without a config file and still getting the abort...
    – itsadok
    May 1, 2017 at 8:22

3 Answers 3


I had the same symptoms that were described in the question as well as a new and stale PID file in /var/run/dnsmasq.pid every 10 seconds. I am working with dnsmasq 2.77 installed via Homebrew, and macOS 10.12.5. I had 29,000+ hosts defined in /etc/hosts, which was fine until some point - upgrading macOS or dnsmasq, perhaps.

I made a backup of /etc/hosts and then removed all lines from the hosts file except as follows.       localhost broadcasthost
::1             localhost broadcasthost

After trying it with the minimal hosts file, I found dnsmasq working.

ps aux | grep dnsmasq
sudo lsof -n -i4TCP:53 | grep 'LISTEN'

But I didn't lose the definitions of hosts to block. They were migrated to the dnsmasq configuration file. A host definition in /etc/hosts looks like the following sample. analytics.google.com

The corresponding definition in dnsmasq.conf looks like the following sample.


Encouraged, I then added back to the hosts file all of my own definitions for my home LAN, my work LAN, some remote host nicknames, and local virtual hosts.


Christopher's answer set me on the right path: the problem was indeed /etc/hosts.

After some trial and error I determined that dnsmasq would crash if /etc/hosts contains a domain name with more than 49 characters.

Since I didn't really want to use /etc/hosts in the first place, I was able to fix the problem by simply adding -h to the command line, or uncommenting the line that says no-hosts in /usr/local/etc/dnsmasq.conf


The launch daemon is restarted because you forgot the initial step to create a dnsmasq.conf file. The conf file is referenced in the plist!


sudo brew services stop dnsmasq
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf

Modify the config file (e.g listening port/interfaces/domain names etc). Then I recommend to copy and launch the launch daemon plist manually - this step has to be executed only once:

sudo cp /usr/local/opt/dnsmasq/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons/
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist 

I have no explanation why the process is aborted starting it manually!

You must log in to answer this question.

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