使用 Homebrew 安装 dnsmasq

Mat*_*ham 5 macos dnsmasq homebrew

我已经使用 Homebrew 安装了 dnsmasq。安装一切似乎都很顺利。

安装后我按照说明进行操作...

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

问题: dnsmasq 似乎无法正常工作。当我跑步时:

sudo dnsmasq

我得到:

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

当我跑步时:

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

我得到:

launchctl stop error: No such process

任何想法发生了什么或如何判断它是否已正确安装并运行?

Gor*_*son 4

launchctl stop采用作业标签,而不是路径(与 launchctlstoplist命令相同)。假设标签是homebrew.mxcl.dnsmasq,您可以使用 检查守护进程的状态sudo launchctl list homebrew.mxcl.dnsmasq(如果它列出了 PID,则它正在运行),如果需要,可以使用 停止它sudo launchctl stop homebrew.mxcl.dnsmasq。如果这不是正确的标签,请在 /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist 中检查该Label键后面的字符串。