Mosquitto: The MQTT Broker That Just Works
You've got devices or services that need to talk to each other, and you don't want to build your own message-passing infrastructure from scratch. That's exactly the problem MQTT was designed to solve, and Eclipse Mosquitto is one of the most established open source brokers implementing it. If you're wiring up sensors, building an IoT prototype, or just want a lightweight pub/sub system, Mosquitto is worth a look.
What It Does
Mosquitto is an open source server implementation of the MQTT protocol, supporting versions 5.0, 3.1.1, and 3.1. In plain terms, it's a broker—a central hub that receives messages published to topics and forwards them to clients subscribed to those topics. It ships with both C and C++ client libraries, so you can build applications that speak MQTT directly.
Beyond the broker itself, the project includes a set of command-line utilities. mosquitto_pub and mosquitto_sub handle publishing and subscribing from the terminal. mosquitto_rr does request/response. And for administration, there's mosquitto_ctrl, mosquitto_signal, and mosquitto_passwd for managing the broker and dealing with credentials. It's a fairly complete toolkit rather than just a single daemon.
Why It's Cool
-
It covers the whole workflow. A lot of projects give you the core piece and leave you to figure out the rest. Mosquitto hands you the broker, client libraries in two languages, and command-line tools for both messaging and administration. You're not hunting for separate utilities to manage passwords or signal the broker.
-
Protocol version support is broad. Supporting MQTT 5.0 alongside 3.1.1 and 3.1 means you can work with newer clients that take advantage of v5 features while still accommodating older devices that only speak v3. That flexibility matters in real deployments where hardware doesn't always move in lockstep.
-
Sensible defaults for testing. Run
mosquittowith no arguments and you get a working broker that allows anonymous access—but only from the local machine. That's a thoughtful design choice. You can test immediately without configuring authentication, and you're not accidentally exposing an open broker to the network. -
A public test server exists. The project maintains
test.mosquitto.org, which means you can experiment with MQTT clients without even running a broker locally. Handy for quick client-side development. -
The documentation is thorough. Man pages cover the broker, clients, and the client library API, with everything available online. There's dedicated documentation on authentication methods and the dynamic security plugin—topics that often get glossed over but are essential once you move past local testing.
How to Try It
The quickest path is to install a binary package for your platform—details are at mosquitto.org/download. With a binary install, the broker often starts automatically. If not, just run:
mosquitto
Then, in one terminal, subscribe to a topic:
mosquitto_sub -t 'test/topic' -v
And in another, publish a message:
mosquitto_pub -t 'test/topic' -m 'hello world'
That's it—you'll see the message appear on the subscriber side. Keep in mind this default setup only accepts local connections with anonymous access, so it's strictly for initial testing.
When you're ready for clients on other machines, you'll need a configuration file. Binary packages typically place one at something like /etc/mosquitto/mosquitto.conf. If you compiled from source, write your config and start with:
mosquitto -c /path/to/mosquitto.conf
From there you'll define a listener and decide on authentication. The README explicitly advises against running with anonymous access on a public-facing broker, and points to the authentication methods and dynamic security plugin docs for guidance.
If you'd rather build from source, grab the archive from the download page. Windows and Mac builds use cmake; other platforms use make. Note that building from the git repository skips documentation—use make binary to skip man pages, or install docbook-xsl on Debian/Ubuntu. Required dependencies include cJSON; optional ones (like OpenSSL for TLS, or c-ares for SRV support) can be toggled with build flags such as WITH_TLS=no or WITH_SRV=yes.
The source lives at github.com/eclipse-mosquitto/mosquitto, where you can also file issues.
Final Thoughts
Mosquitto isn't trying to be flashy—it's trying to be a solid, well-documented MQTT broker with the supporting tools you actually need. For developers building IoT systems, home automation, or any pub/sub architecture, it's a pragmatic starting point. The included client libraries and admin utilities mean less glue code on your end, and the clear documentation on authentication saves you from the classic mistake of leaving a broker wide open. If you're new to MQTT, the local-only default and public test server make it easy to learn without risk.
Follow @githubprojects for more developer tools and open source projects.