Set up local development environment with MacOS

This guide explains what is necessary building OpenNMS from source code on your local macOS machine.

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.

Afterward verify with git that it works:

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

Install OpenJDK 8

It is required to have OpenJDK 8 Development Kit installed. The description how to install can be found on Homebrew OpenJDK.

You can also download Oracle JDK 8 for macOS from the Oracel Java 8 SE [download page]((https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html).

After Installation verify that java has been correclty installed:

> java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)

Windows Installer (Makensis)

When building OpenNMS from source also a windows installer is compiled and can be installed using brew:

brew install makensis

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

Maven (optional)

We ship a Maven version which is used in our compile and assemble perl scripts. If you prefer mvn commands natively you can install Maven with brew.

brew install maven

> mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 1.8.0_242, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.3", 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 && make install

JICMP 6

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

PostgreSQL

OpenNMS requires a Postgres installation to run. You can use the PostgreSQL app for macOS.

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