This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

Building Zabbix agent on macOS

Overview

This section demonstrates how to build Zabbix macOS agent binaries from sources with or without TLS.

Prerequisites

You will need command line developer tools (Xcode is not required), Automake, pkg-config and PCRE (v8.x). If you want to build agent binaries with TLS, you will also need OpenSSL or GnuTLS.

To install command line developer tools, open terminal and run svn command. Instead of printing short help message, it will display informative message about missing command line developer tools and open new GUI window for installing them. Press "Install" in the dialog window.

To install Automake and pkg-config, you will need a Homebrew package manager from https://brew.sh/. To install it, open terminal and run the following command:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install Automake and pkg-config:

$ brew install automake
       $ brew install pkg-config

Preparing PCRE, OpenSSL and GnuTLS libraries depends on the way how they are going to be linked to the agent.

If you intend to run agent binaries on a macOS machine that already has these libraries, you can use precompiled libraries that are provided by Homebrew. These are typically macOS machines that use Homebrew for building Zabbix agent binaries or for other purposes.

If agent binaries will be used on macOS machines that don't have the shared version of libraries, you should compile static libraries from sources and link Zabbix agent with them.

Building agent binaries with shared libraries

Install PCRE:

$ brew install pcre

When building with TLS, install OpenSSL and/or GnuTLS:

$ brew install openssl
       $ brew install gnutls

Download Zabbix source:

$ svn export svn://svn.zabbix.com/trunk zabbix-source

Build agent without TLS:

$ cd zabbix-source/
       $ ./bootstrap.sh
       $ ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6
       $ make
       $ make install

Build agent with OpenSSL:

$ cd zabbix-source/
       $ ./bootstrap.sh
       $ ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-openssl=/usr/local/opt/openssl
       $ make
       $ make install

Build agent with GnuTLS:

$ cd zabbix-source/
       $ ./bootstrap.sh
       $ ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-gnutls=/usr/local/opt/gnutls
       $ make
       $ make install

Building agent binaries with static libraries without TLS

Let's assume that PCRE static libraries will be installed in $HOME/static-libs. We will use PCRE 8.42.

$ PCRE_PREFIX="$HOME/static-libs/pcre-8.42"

Download and build PCRE with Unicode properties support:

$ mkdir static-libs-source
       $ cd static-libs-source
       $ curl --remote-name https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz
       $ tar xf pcre-8.42.tar.gz
       $ cd pcre-8.42
       $ ./configure --prefix="$PCRE_PREFIX" --disable-shared --enable-static --enable-unicode-properties
       $ make
       $ make check
       $ make install

Download Zabbix source and build agent:

$ svn export svn://svn.zabbix.com/trunk zabbix-source
       $ cd zabbix-source/
       $ ./bootstrap.sh
       $ ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre="$PCRE_PREFIX"
       $ make
       $ make install

Building agent binaries with static libraries with OpenSSL

When building OpenSSL, it's recommended to run make test after successful building. Even if building was successful, tests sometimes fail. If this is the case, problems should be researched and resolved before continuing.

Let's assume that PCRE and OpenSSL static libraries will be installed in $HOME/static-libs. We will use PCRE 8.42 and OpenSSL 1.1.1a.

$ PCRE_PREFIX="$HOME/static-libs/pcre-8.42"
       $ OPENSSL_PREFIX="$HOME/static-libs/openssl-1.1.1a"

Let's build static libraries in static-libs-source:

$ mkdir static-libs-source
       $ cd static-libs-source

Download and build PCRE with Unicode properties support:

$ curl --remote-name https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz
       $ tar xf pcre-8.42.tar.gz
       $ cd pcre-8.42
       $ ./configure --prefix="$PCRE_PREFIX" --disable-shared --enable-static --enable-unicode-properties
       $ make
       $ make check
       $ make install
       $ cd ..

Download and build OpenSSL:

$ curl --remote-name https://www.openssl.org/source/openssl-1.1.1a.tar.gz
       $ tar xf openssl-1.1.1a.tar.gz
       $ cd openssl-1.1.1a
       $ ./Configure --prefix="$OPENSSL_PREFIX" --openssldir="$OPENSSL_PREFIX" --api=1.1.0 no-shared no-capieng no-srp no-gost no-dgram no-dtls1-method no-dtls1_2-method darwin64-x86_64-cc
       $ make
       $ make test
       $ make install_sw
       $ cd ..

Download Zabbix source and build agent:

$ svn export svn://svn.zabbix.com/trunk zabbix-source
       $ cd zabbix-source/
       $ ./bootstrap.sh
       $ ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre="$PCRE_PREFIX" --with-openssl="$OPENSSL_PREFIX"
       $ make
       $ make install

Building agent binaries with static libraries with GnuTLS

GnuTLS depends on the Nettle crypto backend and GMP arithmetic library. Instead of using full GMP library, this guide will use mini-gmp which is included in Nettle.

When building GnuTLS and Nettle, it's recommended to run make check after successful building. Even if building was successful, tests sometimes fail. If this is the case, problems should be researched and resolved before continuing.

Let's assume that PCRE, Nettle and GnuTLS static libraries will be installed in $HOME/static-libs. We will use PCRE 8.42, Nettle 3.4.1 and GnuTLS 3.6.5.

$ PCRE_PREFIX="$HOME/static-libs/pcre-8.42"
       $ NETTLE_PREFIX="$HOME/static-libs/nettle-3.4.1"
       $ GNUTLS_PREFIX="$HOME/static-libs/gnutls-3.6.5"

Let's build static libraries in static-libs-source:

$ mkdir static-libs-source
       $ cd static-libs-source

Download and build Nettle:

$ curl --remote-name https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz
       $ tar xf nettle-3.4.1.tar.gz
       $ cd nettle-3.4.1
       $ ./configure --prefix="$NETTLE_PREFIX" --enable-static --disable-shared --disable-documentation --disable-assembler --enable-x86-aesni --enable-mini-gmp
       $ make
       $ make check
       $ make install
       $ cd ..

Download and build GnuTLS:

$ curl --remote-name https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.5.tar.xz
       $ tar xf gnutls-3.6.5.tar.xz
       $ cd gnutls-3.6.5
       $ PKG_CONFIG_PATH="$NETTLE_PREFIX/lib/pkgconfig" ./configure --prefix="$GNUTLS_PREFIX" --enable-static --disable-shared --disable-guile --disable-doc --disable-tools --disable-libdane --without-idn --without-p11-kit --without-tpm --with-included-libtasn1 --with-included-unistring --with-nettle-mini
       $ make
       $ make check
       $ make install
       $ cd ..

Download Zabbix source and build agent:

$ svn export svn://svn.zabbix.com/trunk zabbix-source
       $ cd zabbix-source/
       $ ./bootstrap.sh
       $ CFLAGS="-Wno-unused-command-line-argument -framework Foundation -framework Security" \
       > LIBS="-lgnutls -lhogweed -lnettle" \
       > LDFLAGS="-L$GNUTLS_PREFIX/lib -L$NETTLE_PREFIX/lib" \
       > ./configure --sysconfdir=/usr/local/etc/zabbix --enable-agent --enable-ipv6 --with-libpcre="$PCRE_PREFIX" --with-gnutls="$GNUTLS_PREFIX"
       $ make
       $ make install