Table of Contents

mosquitto-clients

to be able to build anything on MacOS, install Command Line Tools for Xcode using the following command: xcode-select –install

cmake

To successfully build mosquitto, cmake is required. To install cmake, follow along these instructions: https://cmake.org/install/.

First time install: ./bootstrap make make install

Updating cmake: cmake . make
make install

mosquitto-clients

Clone master-branch from Github: git clone –single-branch -b master https://github.com/eclipse/mosquitto.git Change directory into mosquitto: cd ./mosquitto

Building with SSL-support

When building with SSL: export OPENSSL_ROOT_DIR=“$HOME_BREW/Cellar/openssl/1.x.x” export OPENSSL_INCLUDE_DIR=“$OPENSSL_ROOT_DIR/include”

Generate makefiles cmake .
make & install libmosquitto cd ./lib make sudo make install
make & install mosquitto clients cd ../client make sudo make install

In case you screwed up, clean directory and repeat git clean -f -d git reset –hard

Alternatively: Build without SSL

To build without SSL-support add option -DWITH_TLS=OFF. This inherits -DWITH_TLS_PSK=OFF.

Other options

cmake: Surpress Policy CMP0042 Warning

Add -DCMAKE_MACOSX_RPATH=ON to cmake command

c-ares

If you build with -WITH_SRV=OFF this is not needed.

Download latest archive from https://c-ares.haxx.se ./configure make sudo make install