From OpenFOAMWiki
The current maintainer of this page is Wyldckat (talk).

1 Introduction

This page aims to explain how to install OpenFOAM OF Version 4x.png on any Linux Distribution.

In the following chapters and sections is explained how to generally install OpenFOAM 4.x and related dependencies, such as ParaView:

For dedicated instructions (complete and/or partial) for each Linux Distribution:

Installation/Linux/OpenFOAM-4.x/CentOS SL RHELInstallation/Linux/OpenFOAM-4.x/Ubuntu

Note: In case it doesn't exist for your Linux Distribution, check the ones listed at Installation/Linux/OpenFOAM-4.0 and compare the instructions for other distributions versus the ones available here.

2 About the bug fix version

In case you're wondering what is the difference between the versions 4.0 and 4.x:

  • The version 4.0 is considered to be a stable release that was launched for the main version 4. This specific version won't change over time.
  • The version 4.x is the bug fix version, which is regularly updated overtime, at least until the next major release of OpenFOAM is released.
    • This version is also known as: the git version; the repository version.

So in essence, the version bug fix version 4.x allows one to stay the most up-to-date possible of OpenFOAM's latest source code. This enables the following capabilities:

  • Earlier access to new features, before the next stable release is made.
  • Higher probability of having bugs fixed.
  • When a bug is fixed, it's just a matter of updating the local code repository.
  • When reporting a bug, this is the version that is used as a reference. More specifically, the commit hash is used for keeping track of where in time is your code snapshot (for more, read the chapter Installing from source code).
  • Makes it easier to learn how one can keep track of his/her own changes to the OpenFOAM source code.

Nonetheless, there are some downsides of using the bug fix version:

  • Early access to new bugs.
    • Yes, some bug fixes can introduce new bugs.
  • Some features may be removed, since a bug might have been spotted that would indicate that said feature is incorrect.
  • Not advised for using in a cluster or shared machine environment, since global installations of the bug fix version can get a bit onerous over time!

3 Installing from source code

The official instructions are made available here: Repository Release - version 4.x

A few details to keep in mind:

  1. As already implied on the chapter About the bug fix version, there are only a few differences in building 4.x and 4.0. The main difference is how the source code is downloaded and how you can keep up with updates that are made to the changes made on OpenFOAM's git repository, namely:
    git clone
    • You can also choose to download the ThirdParty-4.x folder from the respective repository:
        git clone
      In which case, you will need to also manually download the packages as listed in the README.html or files in the downloaded folder ThirdParty-4.x.
  2. When you need to update your local clone, for getting the latest source code updates, you can follow the instructions provided in the page Installation/Working with git repositories.
  3. As of OpenFOAM 3.0, the minimum required GCC version is 4.7.0. This implies one of the following situations:
    1. You should use a recent Linux Distribution, so that it can provide GCC 4.7 or any newer version.
    2. In case you have to use an older Linux Distribution and the GCC version provided is older than 4.7, then you'll have to build GCC from source code.
    3. When in doubt, check the Installation/Compatibility Matrix page for information on compatible compilers.
  4. When it comes to ParaView, it's possible to avoid the need to build it from source code. If your Linux Distribution provides ParaView 3.12.0 or newer, you don't need to build ParaView from source code. Simply run:
    paraFoam -builtin
    and it will open the case in ParaView.
    • If the previous command worked, you can add the following alias command in your ~/.bashrc file:
        alias paraFoam='paraFoam -builtin'
    • In case you have an old Linux Distribution and still don't want to build ParaView from source code, get the latest binary version for Linux from ParaView's official website. Then add to your ~/.bashrc file the following line (adapt accordingly):
        export PATH=$HOME/Downloads/ParaView-4.4.0/bin:$PATH

4 Steps for updating

In the bug reports #1941 and #2091, a new (relatively) easy way to update your development build to the latest code can be done by following the next steps, although keep in mind that these steps try to catch all possible scenarios:

  1. Start a new terminal and activate the respective OpenFOAM shell environment.
  2. Pull the latest changes for both repositories, by running the following commands:
    git pull
    git pull
  3. You can update the build by running:
    ./Allwmake -update -j > log.make 2>&1