Installing dnsmasq with Homebrew

Matt Fordham picture Matt Fordham · May 18, 2013 · Viewed 7.3k times · Source

I have installed dnsmasq using Homebrew. All seemed to go fine installing.

After installing I followed the instructions...

cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

The Problem: dnsmasq doesn't seem to to bes working. When I run:

sudo dnsmasq

I get:

dnsmasq: failed to create listening socket for 127.0.0.1: Address already in use

When I run:

sudo launchctl stop /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

I get:

launchctl stop error: No such process

Any ideas what is going on or how to tell if it is installed and running correctly?

Answer

Gordon Davisson picture Gordon Davisson · May 19, 2013

launchctl stop takes a job label, not a path (same with launchctl's stop and list commands). Assuming the label is homebrew.mxcl.dnsmasq, you can check the daemon's status with sudo launchctl list homebrew.mxcl.dnsmasq (if it has a PID listed, it's running), and if necessary stop it with sudo launchctl stop homebrew.mxcl.dnsmasq. If that's not the right label, check in /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist for the string following the Label key.