In this quick guide, we will show you how to install OpenFOAM 2.2.0 on Mac OS X 10.8.3, as known as Mountain Lion.
This post is only a repetition of awesome work by B. Gschaider, and the original link can be found here.
First, we need to make sure we have all the required files before installing OpenFOAM.
1. Xcode | https://developer.apple.com/xcode/
- Download the latest version of Xcode and Command Line Tools. You’re going to need an Apple ID, and probably need to register as a developer. We’re using Xcode 4.6.1, and Command Line Tools (OS X Mountain Lion) for Xcode – March 2013
2. MacPorts | http://www.macports.org/
- Download Macports for Mountain Lion, and installation should be very straightforward (.pkg file)
B. Compilers and Libraries
Gcc4.6, OpenMPI, flex, bison, boost, cgal, ccache
(there was a mistake when I recorded the video. It’s ccache, not cache)
Now you’re ready to use MacPorts to install compilers and libraries using MacPorts. Simply launch Terminal and enter following commands.
sudo port selfupdate
Check if we’re on the same page.
If it returns default GCC 4.2.1, you’ve installed Xcode correctly. Recent updates in OpenFOAM require GCC 4.5 or higher. We’ll use MacPorts to install GCC 4.6
sudo port install gcc46
Select Gcc 4.6 as default compiler by typing the following.
sudo port select gcc mp-gcc46
Check to see if you’re doing it correct so far.
gcc (MacPorts gcc46 4.6.3_9) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Now install OpenMPI by typing
sudo port install openmpi
These two will take a while, so sit back, and try not to scare your computer. You can also install multiple tools using a single command. Try this line to install the remainder.
sudo port install flex bison boost cgal ccache
Option 1 : Download precompiled sparseimage file.
1. Unzip, and double-click the .sparseimage file to mount
2. Create symbolic link on your home directory.
ln -s /Volumes/OpenFOAM-v2.2 OpenFOAM
3. Edit your .profile to source ~/OpenFOAM/OpenFOAM-2.2.0/etc/bashrc when you start up Terminal
Add this line…
4. Clean and recompile OpenFOAM
Option 2 : If it doesn’t work out of the box for some reason, carefully follow this instruction.
This post is not approved or endorsed by ESI Group.