I have installed Mosquitto using brew using
brew install mosquitto
And tested whether it is running using
brew services list
Output
Name Status User Plist
mongodb stopped
mosquitto started amit /Users/amit/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist
postgresql stopped
tomcat stopped
However, when I try the following from this answer I get command not found
mosquitto_sub -v -t 'test/topic'
-bash: mosquitto_sub: command not found
Do I have to install something else for this to work?
Also, I tried to connect to the broker using a python script, but I get a connection refused message
client = mqtt.Client()
client.on_connect = on_connect_handler
client.on_message = on_message_handler
client.connect("localhost", 1883, 60)
client.loop_forever()
EDIT 1
I solved the first issue of not being able to use mosquitto_sub
using brew link mosquitto
.
But I still get a connection refused.