OpenMS
Building OpenMS on Mac OS X

Introduction

This document explains the procedure for building OpenMS from source.

If you only want to use the OpenMS PiPeline (TOPP), you are strongly encouraged to download the binary installer from the OpenMS website instead of building OpenMS from sources. Be aware though that we do not provide binary installers for every macOS version.

If you encounter errors while configuring or compiling OpenMS, search in the issue tracker for a possible solution. If an existing issue can't be found please report the error using the same issue tracker.

Required Applications and Dependencies

In order to compile OpenMS, several applications need to be installed:

  1. A compiler and its toolchain.

    Apple Clang is the officially supported compiler on macOS for building OpenMS (GCC can be used at your own risk). OpenMS is tested with the Apple Clang toolchain that ships with the last three Xcode releases. Older Xcode versions may fail due to missing C++20 features.

    A minimal installation of Apple Clang is achieved by downloading Apple's "Command Line Tools". However we suggest using a full Xcode installation from the Mac App Store. More details can be found on the Apple Developer Site.

    Note
    Since macOS El Capitan 10.11, the command line tools can easily be installed via:
    xcode-select --install
  2. A package manager for installing the remaining dependencies.

    For installing dependencies we suggest using the Homebrew package manager. However, If you would rather built all dependencies from source code you can do so using the OpenMS contrib directory. Details can be found in the section entitled Installing the contrib Package.

    After installing Homebrew the following commands will install all needed dependencies for OpenMS:

    # Update the package index:
    brew update
    # Required dependencies:
    brew install \
    python \
    ccache \
    autoconf \
    automake \
    libtool \
    ninja \
    libomp \
    libsvm \
    xerces-c \
    boost \
    eigen \
    sqlite \
    coinutils \
    cbc \
    cgl \
    clp \
    qt \
    apache-arrow
    # Optional dependencies:
    brew install \
    doxygen \
    ghostscript \
    graphviz
    Note
    If you still have Qt5 or Qt4 installed make sure to brew uninstall or at least brew unlink them, so they are not used when building OpenMS.

Building OpenMS

  1. Begin by obtaining a copy of the OpenMS source code:
OPENMS_DIR=~/openms-development
mkdir -p "$OPENMS_DIR"
cd "$OPENMS_DIR"
git clone --recurse-submodules https://github.com/OpenMS/OpenMS
  1. Then compile the source code:
mkdir -p "$OPENMS_DIR/openms_build"
cd "$OPENMS_DIR/openms_build"
cmake \
-DCMAKE_PREFIX_PATH="$(brew --prefix);$(brew --prefix qt)" \
-DBOOST_USE_STATIC=OFF \
"$OPENMS_DIR/OpenMS"
make -j"$(nproc || sysctl -n hw.logicalcpu || echo 2)"
You can set more CMake variables adding< code > linking and adding include directories</td ></tr >< tr >< th valign="top"> CMAKE_PREFIX_PATH</td >< td > Additional search path for the contrib libraries[MacOSX only] If you want to use libraries installed via Homebrew or MacPorts you might need to provide the corresponding paths< code > DCMAKE_PREFIX_PATH
Definition: common-cmake-parameters.doxygen:20
Note
After executing CMake you can list all of the make targets by running make targets.
  1. The TOPP tools should now be ready to use.

    The applications are located in the $OPENMS_DIR/openms_build/bin directory.

    Note
    If you intend to use third party search engines like Comet, their binaries also need to be in the PATH environment variable. You can find pre-built binaries in the OpenMS THIRDPARTY directory. To use them set the PATH environment variable using the following command:
    export PATH="$OPENMS_DIR/OpenMS/THIRDPARTY/MacOS/$(uname -m)/Comet:$PATH"

Additional CMake Flags

You can set more CMake variables adding -DVARIABLE=VALUE options when calling CMake.
The most important CMake variables are:

OPENMS_CONTRIB_LIBS Separate search path for the contrib libraries from github.com/OpenMS/contrib that is internally considered before CMAKE_PREFIX_PATH for searching, linking and adding include directories.
CMAKE_PREFIX_PATH

Additional search path for the contrib libraries.

[MacOSX only] If you want to use libraries installed via Homebrew or MacPorts you might need to provide the corresponding paths

-DCMAKE_PREFIX_PATH=/usr/local/Cellar for Homebrew -DCMAKE_PREFIX_PATH=/opt/local for MacPorts

Please keep in mind that both Homebrew and MacPorts do not provide all libraries so you also need to specify the path to your self-build contrib via -DOPENMS_CONTRIB_LIBS

Qt6_DIR Additional search path for the Qt6 CMake files. Use /PATH/TO/QT_INSTALLATION/lib/cmake/Qt6 as value, e.g. C:\dev\qt6\6.7.1\msvc2019_64\lib\cmake\Qt6
HAS_XSERVER=On/Off [Linux/MacOS only] Defines if a running X Server is available when building OpenMS. As building parts of the documentation and running certain tests requires a running X Server, this flag can be used to disable those parts of the documentation and the tests that need an X Server. (Default: On)
ADDRESS_SANITIZER=On/Off [g++/clang only] Enables/Disables Address Sanitizer (ASAN) to find access violations and other bugs.
WITH_GUI=On/Off Defines if the OpenMS GUI tools (TOPPView, TOPPAS) should be built or not. If you plan to use OpenMS without a GUI, set this flag to "Off" (Default: On)
ENABLE_DOCS=On/Off Enables documentation targets, allowing to build the OpenMS documentation. (Default: On)
GIT_TRACKING=On/Off Embed Git checksum into the library. (Default: On)
ENABLE_UPDATE_CHECK=On/Off Check online for OpenMS Updates upon invocation of any TOPP tool. (Default: On)
CMAKE_BUILD_TYPE [makefiles only; does not apply for XCode or VS] Should be either 'Release' (optimization enabled) or 'Debug' (debug info and precondition/postcondition checks enabled).
The default is Release.
CMAKE_CXX_COMPILER Defines the C++ compiler to use.
MY_CXX_FLAGS Additional custom C++ compile options you would like to add (must fit your chosen compiler). This might be useful, for example, for adding debug symbols to a Release build, or for performance analysis (e.g. for ... -DMY_CXX_FLAGS="-Og;-ggdb;-g3;-fno-omit-frame-pointer" ...)
CMAKE_C_COMPILER Defines the C compiler to use. This should match the C++ compiler. Mixing compilers (e.g., clang++ for C++ and gcc for C) can lead to undefined behaviour as some internal settings (e.g., OpenMP support) are determined using the C compiler and are assumed to be the same for the C++ compiler.
SEARCH_ENGINES_DIRECTORY (optional) The location where thirdparty search engines (X!Tandem, MSGF+) are located. This directory should have the same structure as the example in the search engine repository at https://github.com/OpenMS/THIRDPARTY after flattening for your platform. /. This directory is only needed to include thirdparty tools in the installer for OpenMS.
PYOPENMS=Off/On Create Python bindings, see also pyOpenMS (Default: Off)
CMAKE_INSTALL_PREFIX

the path where the bin/ and lib/ directories should be installed to (when

sudo make install

is wished for a system-wide install: e.g. -DCMAKE_INSTALL_PREFIX=/usr/local/)
Note: Moving these directories after installing is not supported.

For development, install prefixes are not supported. In this case OpenMS must be built in place!

A full list of the CMake variables is shown when you execute:
ccmake .
This works only after having executed `cmake` at least once.

Testing the OpenMS/TOPP Installation

After building OpenMS and TOPP, you should test your installation by executing the following command:

make test
bool test
Status of the current subsection.
or
ctest
By using `ctest` you can also execute a subset of tests by using the `-R SUBSTRING` option and run tests in parallel using the `-j` option. For example,
ctest -R TOPP_ -j 4
const double R
Definition: Constants.h:149
will run all TOPP test using 4 jobs.For more information, consult the `ctest` [man page][ctest].[ctest]: http://manpages.ubuntu.com/manpages/hardy/man1/ctest.1.html

Installing the contrib Package

Under certain circumstances you may want to build all dependencies from source code. In order to facilitate the installation of the libraries required for OpenMS we provide a "contrib" package containing the following libraries: Boost, Eigen, libSVM, libHDF5, glpk, zlib, bzip2, CoinMP and Xerces-C.The following commands can be used to build all of these dependencies (assuming you have already cloned the OpenMS repository using the commands previously used in this document):

mkdir -p "$OPENMS_DIR/contrib_build"
cd "$OPENMS_DIR/contrib_build"
cmake -DBUILD_TYPE=ALL -DNUMBER_OF_JOBS=8 "$OPENMS_DIR/OpenMS/contrib"
@ ALL
all dimensions are filled
Alternatively, you can build one dependency at a time by using the `BUILD_TYPE` flag. For example:
cmake \
-DBUILD_TYPE=LIBSVM \
-DNUMBER_OF_JOBS="$(nproc || sysctl -n hw.logicalcpu || echo 2)" \
"$OPENMS_DIR/OpenMS/contrib"
If everything worked, the following sub-directories were created under the `contrib` build directory:
  • `lib`: containing the libraries needed by OpenMS.
  • `include`: containing the header files needed for OpenMS.
You can now build OpenMS with the instructions in this document by adding the following flag to `cmake`:
-DOPENMS_CONTRIB_LIBS="$OPENMS_DIR/contrib_build"