Set Up Prerequisites

Minimum requirements

The minimum prerequisites to build OGS are:

  • An 64-bit operating system (Linux, Windows 7 and up, macOS)
  • Git (version control tool, at least version 2.14)
  • CMake (build configuration tool, at least version 3.14)
  • A compiler with C++20-support
  • Optional (but recommended): Ninja build tool
  • Optional: Conan package manager (at least version 1.34.0) for some optional dependencies.

Note about skipping installation steps

A fresh system with none of the prerequisites fulfilled is assumed. Skipping installation steps or using a non-supported version might result in unexpected problems. If possible, you may consider reinstalling or manual modifying the configuration of the already installed tool.

Step: Install a compiler

Alternative setup

Please note that the following setup on Windows is the native Windows development setup. This native setup is quite involved and heavy on system resources. We can recommend an alternative setup in which the Windows Subsystem for Linux is used: Setup and development of OGS follows the Linux way but you can use your Windows IDE (especially Visual Studio Code) for development and debugging. If this sounds interesting please follow the steps here!

As we use lots of features of the C++17-standard we support Visual Studio 2019 with compiler version 19.24 and up. Therefore you will need at least Windows 7 (64-bit required). It is perfectly fine to use the free Community Edition of Visual Studio.

  • Download and install Visual Studio Community
    • Select the workload Desktop Development with C++
    • You can uncheck everything else
  • When installation finished please start Visual Studio once (when asked for credentials enter your Microsoft account or click on Skip for now)
On Debian-based (e.g. Ubuntu) you need to install the `build-essential`-package (which contains the `gcc`-compiler and the `make`-tool):
sudo apt install build-essential

You need to have at least gcc 9.0:

$ gcc --version
gcc (GCC) 9.0.0

Install a newer compiler on Ubuntu

We recommend using Ubuntu 20.04 as its standard gcc package is already at version 9. If you are on an older Ubuntu version you can install a newer compiler from the ubuntu-toolchain-r/test-repository:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-9 g++-9

To make the newly installed compiler the default one:

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 \
  --slave /usr/bin/g++ g++ /usr/bin/g++-9

If you do not do this you have to specify the compiler during the first CMake run:

CC=gcc-9 CXX=c++-9 cmake ../ogs [more CMake options]
Please install Xcode from the App Store. Then please run the following command in the terminal to install the command line tools:
xcode-select --install

Open Xcode one time to install some other Xcode stuff.

Now also install the Homebrew package manager:

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

The Homebrew package manager is needed for installing other libraries and packages. It is just like a linux package manager.

Step: Install Git

Git is a powerful and distributed version control system. OGS source code is hosted on GitLab. See the developer guide page on Code Reviews for more info on how OGS uses GitLab for collaborative development.

Download and install git from the git homepage. Use the default installer options but also enable Enable symbolic links under the Configuring extra options page.

Enable symbolic links option

This install a new command line called Git Bash which should be used for all git operations.

Let Git know who you are:

git config --global user.name "Your Name Here"
git config --global user.email "your_email@example.com"

In some corporate environments you may have to use a proxy server. In this case tell git about it:

git config --global http.proxy http://yourproxy.example.com

Please check if Git is already installed:

$ git --version
git version 2.14

Otherwise please install Git with your favorite package manager:

sudo apt-get install git

Let Git know who you are:

git config --global user.name "Your Name Here"
git config --global user.email "your_email@example.com"

Optionally enable password storing when interacting with a remote server:

git config --global credential.helper store

In some corporate environments you may have to use a proxy server. In this case tell git about it:

git config --global http.proxy http://yourproxy.example.com

Git is already installed.

Let Git know who you are:

git config --global user.name "Your Name Here"
git config --global user.email "your_email@example.com"

The graphical GitHub client is also maybe worth a look.

In some corporate environments you may have to use a proxy server. In this case tell git about it:

git config --global http.proxy http://yourproxy.example.com

Step: Install CMake

  • Download the installer, at the CMake download page choose the Windows (Win32 Installer).
  • Execute the installer, please check the Add CMake to the system path for all users-option

Install CMake via Kitware’s APT Repository by following their instructions.

For other linux distributions you want to use your distributions package manager, pip or snap.

Install CMake with Homebrew:

brew install cmake

Optional: Install Ninja

We recommend ninja as a cross-platform build tool (make-replacement).

Download the binary from GitHub and put the extracted ninja.exe in the PATH.

sudo apt-get install ninja-build

Install Ninja with Homebrew:

brew install ninja

Optional: Install Python 3

  • Download the Python 3 installer
  • Install with the following options
    • Check Add Python 3.X to PATH
    • Customize installation
    • Make sure to have pip enabled (you may uncheck Documentation, tcl/tk, Python test suite)
    • Check Add Python to environment variables!

Install Python 3 and pip:

sudo apt-get install python3 python3-pip

Install Python 3 with Homebrew:

brew install python

Optional: Install Qt for the Data Explorer

Use Another Qt installer(aqt) for installing the Qt binaries to some path on your machine:

pip install aqtinstall
mkdir qt
cd qt
aqt install 5.15.2 windows desktop win64_msvc2019_64 -m qtxmlpatterns

This will install Qt to [your-directory]/qt/5.15.2/msvc2019_64.

To finish add [your-directory]/qt/5.15.2/msvc2019_64/bin bin to the PATH environment variable.

pip install aqtinstall
mkdir /opt/qt
cd /opt/qt
aqt install 5.15.2 linux desktop gcc_64 -m xmlpatterns,x11extras

Make sure to add /opt/qt/5.15.2/gcc_64/bin to the PATH.

pip install aqtinstall
mkdir /opt/qt
cd /opt/qt
aqt install 5.15.2 mac desktop clang_64 -m xmlpatterns,x11extras

Make sure to add /opt/qt/5.15.2/clang_64/bin to the PATH.

Optional: Install Conan package manager

You only need Conan if you intend to build with one of the following settings and do not want to install their dependencies manually:

  • OGS_USE_NETCDF – NetCDF IO, requires netcdf-cxx4

Install Conan (>= 1.34.0) with Python’s pip:

pip3 install --user conan

This installed conan to .local/bin (or C:\Users\[username]\AppData\Roaming\Python\Python39\Scripts on Windows) in your home directory. Make sure to have this directory in your PATH!

Check on a newly opened command line if Conan was installed successfully:

$ conan --version
Conan version 1.34.0

Advanced usage: You can also have Conan auto-installed when using the CMake-option OGS_USE_CONAN=auto. See the page on Python environment for details.


This article was written by Lars Bilke. If you are missing something or you find an error please let us know. Generated with Hugo 0.79.0. Last revision: September 22, 2021
Commit: [web] Use generated notebook output. fd7eacd2ab  | Edit this page on