Homebrew dnsmasq “Service exited with abnormal code: 2” (Mac OS X Sierra 10.12.6)


I installed dnsmasq through Homebrew. Unfortunately it constantly crash and is resumed by launchd through brew services launch script.

This is the log:

Jun 11 10:45:33 MacBook-Pro com.apple.xpc.launchd[1] (homebrew.mxcl.dnsmasq[48386]): Service exited with abnormal code: 2 Jun 11 10:45:33 MacBook-Pro com.apple.xpc.launchd[1] (homebrew.mxcl.dnsmasq): Service only ran for 0 seconds. Pushing respawn out by 10 seconds. 

I set it up following some tutorials, this is my settings.

#/private/etc/Hosts  127.0.0.1       localhost 255.255.255.255 broadcasthost ::1             localhost  fe80::1%lo0     localhost  # [...]  127.0.0.1               local.web 0:0:0:0:0:ffff:7f00:1   local.web fe80::1%lo0             local.web 127.0.0.1               fullpipeumbrella.loc 0:0:0:0:0:ffff:7f00:1   fullpipeumbrella.loc fe80::1%lo0             fullpipeumbrella.loc  # [...]  127.0.0.1               localhost.demo1.com 0:0:0:0:0:ffff:7f00:1   localhost.demo1.com fe80::1%lo0             localhost.demo1.com  #/usr/local/etc/dnsmasq.conf  domain-needed bogus-priv no-resolv server=8.8.8.8 server=208.67.220.220 

This is the output of brew services list:

$   brew services list Name    Status  User     Plist dnsmasq started root     /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist httpd   stopped           php     started username /Users/username/Library/LaunchAgents/homebrew.mxcl.php.plist php@7.1 stopped           php@7.2 stopped           

And the output of ps, $ ps -e | grep -v grep | grep dnsmasq:

   65 ??         0:02.31 /usr/local/opt/dnsmasq/sbin/dnsmasq --keep-in-foreground -C /usr/local/etc/dnsmasq.conf 

Finally I made a test with dscacheutil:

$   dscacheutil -q host -a name fullpipeumbrella.loc name: fullpipeumbrella.loc ipv6_address: ::ffff:127.0.0.1 ipv6_address: fe80:1::1  name: fullpipeumbrella.loc ip_address: 127.0.0.1 

Thanks in advance… 🙂