Category Archives: MQTT

Build Paho MQTT c library on Mac OS X

This post describes how to build the Paho MQTT library on Mac OS X with MacPorts openssl.

Prepare your system

Install the compiler

You need Xcode or the Xcode command line utils. If you’re not sure if they are already installed open a terminal and try to run the gcc command. If you need to install the compiler a popup will appear to do so.

Install Mac Ports

If not done already download and install the MacPort system and install the openssl library by executing the following command:

sudo port install openssl

You need at least openssl-1.0.1g_0 to not be affected by heartbleed bug!

Clone the repository

Get the latest version because there are some improvements done the last weeks.

git clone git://git.eclipse.org/gitroot/paho/org.eclipse.paho.mqtt.c.git

Prepare the build environment

Change to the build directory within the repository:

cd org.eclipse.paho.mqtt.c/build/

Now we need to export some environment variables:

export SSL_DIR=/opt/local/
export MQTTCLIENT_DIR=../src

If you want to build the samples:

export BUILD_SAMPLES=YES
export SAMPLES_DIR=../src/samples

Now give it a try and run make

make

There should now be some output shown and a darwin_ia64 folder should be created. There you find your paho c library files.

Hope this helps to build your paho library.