18th January 2017

Download OpenFOAM-dev | macOS

The openfoam-dev pack provides an installation  of the current development line of OpenFOAM, packaged for Ubuntu 14.04, 16.04 and 16.10.  Known as OpenFOAM-dev, that contains the source code for the next major release of OpenFOAM. The pack is updated weekly to bring cutting-edge developments to users without them needing to compile source code.  Users can conveniently run OpenFOAM-dev on macOS, using Docker for Mac to provide a self-contained environment for OpenFOAM-dev that includes code, runtime, system tools and libraries.  Requirements for Docker for Mac are:

  • a 2010 or newer model, with Intel’s hardware support for memory management unit (MMU) virtualization;
  • macOS 10.10.3 Yosemite or newer;
  • at least 4GB of RAM;
  • VirtualBox prior to version 4.3.30 must NOT be installed.

Step 1: Before Installing Docker

  1. The user requires superuser password authentication to execute the following commands with sudo. If in doubt, talk to your system administrator.
  2. Ensure you have a network connection to download packages via http(s).
  3. The user can choose to enable graphical applications from the container.  This is generally beneficial because it allows applications like gnuPlot to run (used for monitoring data, e.g. residuals with foamMonitor).  However…
  4. The speed of ParaView running from the Docker container is very slow.  For much better performance, users can install ParaView directly on macOS.  Note, however, that builds of ParaView direct from its producer, Kitware, do not contain the official reader module for OpenFOAM data, but instead use a native reader module that is not fully functional.
  5. OpenFOAM file names are case-sensitive.  If you wish to output data to an OpenFOAM-compatible file system, which we recommend, check whether your file system is case-sensitive before proceeding.

Step 2: Installing Docker for Mac

Follow the Instructions for Installing Docker for Mac.

Step 3: Installing openfoam-dev-macos

OpenFOAM-dev is launched from a script named openfoam-dev-macos.  The script is available from the OpenFOAM Download Site and needs to be located somewhere on the user’s PATH for convenient execution.  The following commands will then install in the system-wide /usr/local/bin directory and make the script executable:

sudo curl --create-dirs -o /usr/local/bin/openfoam-dev-macos
sudo chmod 755 /usr/local/bin/openfoam-dev-macos

Step 4: Enabling Graphical Applications (optional, recommended)

The Docker container runs Ubuntu Linux which uses the X Window System (“X11”, or “X”) to display graphical applications, such a ParaView, gnuPlot and gedit.  Graphical applications can be displayed in the host macOS by connecting the application programs from the container to an X server on the host.  macOS does not run an X server by default, so the user needs to install and run one; the most popular is Xquartz, which can be run as follows:

  1. Go to the Xquartz website, select the latest download and install.
  2. Start XQuartz.
  3. Select XQuartzPreferencesSecurity
  4. Check “Allow connections from network clients” and “Authenticate connections”.
  5. Shut down and Restart XQuartz.

Step 5: Case-sensitive filing system

If the user’s filing system is not case-sensitive, then they can create a case-sensitive volume using the openfoam-macos-file-system script.  Install the script in the system-wide /usr/local/bin directory and make it executable by:

sudo curl -o /usr/local/bin/openfoam-macos-file-system
sudo chmod 755 /usr/local/bin/openfoam-macos-file-system

In default-mode, the script will create a volume named openfoam with size of 10GB, mounted at $HOME/openfoam, which includes a run directory corresponding to the $FOAM_RUN environment variable in the Docker container.  The defaults can be overridden using options listed by running with the help option by:

openfoam-macos-file-system -h

In particular, the user can set the size of the volume for their OpenFOAM data with “-s <size>” where size is in GB.  Commands exist to create, mount, unmount, delete and compact the volume:

  1. openfoam-macos-file-system -s 20 create : creates a 20GB file system.
  2. openfoam-macos-file-system mount : mounts the file system.
  3. openfoam-macos-file-system unmount : unmounts the file system.
  4. openfoam-macos-file-system automount : mounts the file system, automatically on machine boot.
  5. openfoam-macos-file-system delete : deletes the file system permanently, losing all data.

Step 6: Launching openfoam-dev-macos

The Docker container mounts the user’s file system so that case files are stored permanently. The container mounts the directory from where openfoam-dev-macos is launched by default, but the user can also specify the directory using the “-d” option.  Mounting the user’s $HOME directory is disallowed.  Where a case-sensitive volume has been created, the container mount directory would typically coincide with the mount directory (or sub-directory) of the volume.  For example, for a case-sensitive volume mounted in the default location, $HOME/openfoam, the Docker container is run without ParaView as follows:

cd $HOME/openfoam

To run the container with ParaView, use the “-p” option, i.e.

openfoam-dev-macos -p

The first time the container is launched, there is a short wait while the image downloads and unpacks.  Note that mounted directory is represented in the container environment by the WM_PROJECT_USER_DIR environment variable.

Step 7: Testing openfoam-dev-macos

Assuming the run directory already exists (if not, run “mkdir -p $FOAM_RUN”), copy across the backward facing step example, generate the mesh with blockMesh and run the steady flow, incompressible solver simpleFoam

cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
cd pitzDaily

If ParaView is included in the container, then it can be run from the container by typing:


Refer to the OpenFOAM User Guide to get started.

Step 8: Exiting Docker

When finished using OpenFOAM in Docker exit the environment by typing:


Upgrading openfoam-dev

To upgrade the Docker image to the latest version of openfoam-dev, simply launch with the “-u” option, i.e.

openfoam-dev-macos -u

Reporting Issues

If you encounter an issue with this installation, please report it to the OpenFOAM Issue Tracking system.

Thanks to Francesco Contino (from the Contributors to OpenFOAM) and Arnaud Borner for testing and reporting their experience with OpenFOAM on macOS.