Tuesday, July 7, 2015

Install #mosquitto on mac using #homebrew and related commands

$ brew install mosquitto
==> Installing dependencies for mosquitto: c-ares, openssl, libwebsockets
==> Installing mosquitto dependency: c-ares
==> Downloading https://homebrew.bintray.com/bottles/c-ares-1.10.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring c-ares-1.10.0.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/c-ares/1.10.0: 57 files, 540K
==> Installing mosquitto dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2c.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2c.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2c: 463 files, 18M
==> Installing mosquitto dependency: libwebsockets
==> Downloading https://homebrew.bintray.com/bottles/libwebsockets-1.4.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libwebsockets-1.4.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/libwebsockets/1.4: 23 files, 3.3M
==> Installing mosquitto
==> Downloading https://homebrew.bintray.com/bottles/mosquitto-1.4.2.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mosquitto-1.4.2.yosemite.bottle.tar.gz
==> Caveats
mosquitto has been installed with a default configuration file.
You can make changes to the configuration by editing:
    /usr/local/etc/mosquitto/mosquitto.conf


To have launchd start mosquitto at login:
    ln -sfv /usr/local/opt/mosquitto/*.plist ~/Library/LaunchAgents
Then to load mosquitto now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mosquitto.plist
Or, if you don't want/need launchctl, you can just run:
    mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
==> Summary

🍺  /usr/local/Cellar/mosquitto/1.4.2: 28 files, 700K


To run Mosquitto:

/usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf


Installing mosquitto on ubuntu
sudo apt-get install mosquitto

In another tab Subscribe , with verbose and debug mode


mosquitto_sub -v -d -h localhost -t sandeep

In another tab Pusblish
mosquitto_pub -d -h localhost -t sandeep -m "Up and Running"

You will see subscribe received message
Up and Running

Running mosquitto process on port 1883

ps -ef | grep mosq && netstat -tln | grep 1883

client id -  default name.hostname




mosquitto_sub [-1] [-A bind_address] [-c] [-d] [-h hostname] [-i client_id] [-I client id prefix] [-k keepalive time] [-p port number] [-q message QoS] [-R] [-S] [-N] [--quiet] [-v] [ [-u username] [-P password] ] [ --will-topic topic [--will-payload payload] [--will-qos qos] [--will-retain] ] [[ { --cafile file | --capath dir } [--certfile] [--key file] [--tls-version version] [--insecure] ] | [ --psk hex-key --psk-identity identity [--tls-version version] ]] [-T filter-out...] -t message-topic...



mosquitto_pub [-A bind_address] [-d] [-h hostname] [-i client_id] [-I client id prefix] [-p port number] [-q message QoS] [--quiet] [-r] [-S] { -f file | -l | -m message | -n | -s } [ [-u username] [-P password] ] [ --will-topic topic [--will-payload payload] [--will-qos qos] [--will-retain] ] [[ { --cafile file | --capath dir } [--cert file] [--key file] [--ciphers ciphers] [--tls-version version] [--insecure] ] | [ --psk hex-key --psk-identity identity [--ciphers ciphers] [--tls-version version] ]] -tmessage-topic

mosquitto_pub [--help]

No comments:

Post a Comment