Macos 无法在Mac上测试MOSQUITO服务器
我已经使用brew安装了MOSQUITOMacos 无法在Mac上测试MOSQUITO服务器,macos,mosquitto,Macos,Mosquitto,我已经使用brew安装了MOSQUITO brew安装MOSQUITO 并测试它是否正在使用 brew服务列表 输出 Name Status User Plist mongodb stopped mosquitto started amit /Users/amit/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist postgresql stopped tomcat stopped 然而,当
brew安装MOSQUITO
并测试它是否正在使用
brew服务列表
输出
Name Status User Plist
mongodb stopped
mosquitto started amit /Users/amit/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist
postgresql stopped
tomcat stopped
然而,当我尝试以下答案时,我得到的命令没有找到
mosquitto_sub -v -t 'test/topic'
-bash: mosquitto_sub: command not found
我必须安装其他东西才能工作吗
此外,我尝试使用python脚本连接到代理,但收到一条连接被拒绝的消息
client = mqtt.Client()
client.on_connect = on_connect_handler
client.on_message = on_message_handler
client.connect("localhost", 1883, 60)
client.loop_forever()
编辑1 我解决了第一个问题,即无法使用
mosquitto\u sub
使用brew链接mosquitto
但我还是被拒绝了。在谷歌搜索并尝试了不同的方法后,我找到了这两个问题的答案
brew link MOSQUITO
解决的。要检查brew链接的工作方式,可以检查postbrew服务即可启动MOSQUITO-d
工作。我不知道为什么这会起作用,而不是开始一个正常的过程您的Python脚本无法“按原样”工作,因为您尚未安装或导入Mosquito客户端。我已经这样做了。我没有把它添加到问题中,因为我认为它是含蓄的。然而,我已经找到了答案。谢谢你花时间看一看。干得好!请将您的结果添加为答案,然后您可以接受您自己的答案并获得积分,帮助社区。