Set up local development environment (MacOS)

This guide explains what is necessary to get OpenNMS build on your local MacOS machine.

If you prefer using docker, move on. This topic is not for you.

Compile Prerequisites

In order to compile OpenNMS at least the following requirements should be met:

  1. The latest JDK 8 version should be installed

  2. makensis

  3. cloned github OpenNMS repository

  4. maven (optional)

Run Prerequisites

  1. PostgreSQL server

  2. Jicmp, jicmp6 (both optional)

Satisfy compile Prerequisites

Install git

Git is required to interact with the OpenNMS’ source code repository hosted on Github

The easiest way to install git, is to just type in git in the terminal.
MacOS asks you to install XCode Command Line Tools.

However as we need other dependencies as well, I’d recommend installing homebrew instead.

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

See https://brew.sh/index_de for more details.

This will also install the XCode command line tools and therefore git as well.

Afterwards verify with git that it actually works:

> git --version
git version 2.20.1 (Apple Git-117)

Install JDK 8

As of writing this topic only JDK 8 is supported to build from source. I personally use Oracle JDK 8, but you can also use OpenJDK if you like.

Download Oracle JDK 8 for MacOS from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

After Installation verify that java has been correclty installed:

> java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

Windows Installer (Makensis)

When building OpenNMS from source also a windows installer is compiled. In order to do this successfully you can either install the according packages via brew:

brew install makensis

If you are not interested in the Windows Installer bits, you can also simply use a nsis.sh script which simply exits with 0 and put it on your path.

Afterwards ensure makensis can be invoked from your path:

> makensis
Usage:
makensis [ option | script.nsi | - ] [...]

Maven (optional)

I personally like to use mvn commands instead of ./compile.pl, ./clean.pl or ./assemble.pl in certain cases:

brew install maven

Simply verify afterwards:

> mvn --version
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00)
Maven home: /usr/local/Cellar/maven/3.6.1/libexec
Java version: 1.8.0_211, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home/jre
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"

The version is not that important, but should be anything >=3.5.2

Satisfy run prerequisites

JICMP and JICMP 6

brew install automake
brew install autogen

JICMP

git clone https://github.com/OpenNMS/jicmp.git
cd jicmp
git submodule update --init --recursive
autoreconf -fvi
./configure
make

JICMP 6

git clone https://github.com/OpenNMS/jicmp6.git
cd jicmp6
git submodule update --init --recursive
autoreconf -fvi
./configure
make

Postgres

OpenNMS requires a Postgres installation to run.

I personally use the Postgres.app for MacOS.

Simply download it from here and copy it to your Applications folder.

That’s it

Now everything should be set up to build OpenNMS from source and afterwards run it from the command line, which is covered in another topic.

1 Like