Difference between revisions of "Installation/Mac OS/OpenFOAM-1.6-ext"

From OpenFOAMWiki
(Tested installation time)
(Install Xcode via the apple store)
Line 40: Line 40:
 
The Xcode download may take long (several GBs), depending on your internet connection.
 
The Xcode download may take long (several GBs), depending on your internet connection.
  
==== Install Xcode via the apple store ====
+
==== Install Xcode ====
 +
Install it via Apple Store
 
https://developer.apple.com/xcode/
 
https://developer.apple.com/xcode/
  

Revision as of 15:21, 26 October 2013

This page guides you through an installation of OF Version 16ext.png on your Mac.

Bernhard Grieser
Zurich, 2013-10-26


1 Tested Setup

Mac
iMac 21.5" Late 2013 :: 3.1 GHz Intel Core i7 :: Mac OS X Mountain Lion 10.8.5 (12F2015) :: darwin12.5.0

Xcode
Version 5.0 (5A1413)

MacPorts
Version 2.2.0

OpenFOAM
Version 1.6-ext
(pulled on 10/24/2013 via git://git.code.sf.net/p/openfoam-extend/OpenFOAM-1.6-ext)

Paraview
Version 4.0.1 64-bit


Hint for Linux newcomers:
This tutorial uses the vim editor. Check out the man page for editing/saving/closing files with vim by typing

man vim


2 Installation

2.1 Xcode

2.1.1 Installation time

The Xcode download may take long (several GBs), depending on your internet connection.

2.1.2 Install Xcode

Install it via Apple Store https://developer.apple.com/xcode/

2.1.3 Install Xcode command line tools

  • by GUI

xcode -> Preferences -> Downloads

  • by terminal
xcode-select --install


2.2 MacPorts

2.2.1 Installation time

This may take several hours.

2.2.2 Install MacPorts from source as described on the website

http://www.macports.org/install.php#source

2.2.3 Update the Portfiles

sudo port -v selfupdate

2.2.4 Upgrade any existing but outdated ports

sudo port upgrade outdated

2.2.5 Install a gnu c++ compiler (choose one)

My choice was gcc46

sudo port install gcc45
sudo port install gcc46

2.2.6 Install your preferred python version (choose one)

My choice was python26

sudo port install python25
sudo port install python26
sudo port install python27

2.2.7 Mac OS X Mavericks only

Prepare the installation of perl5.8

vim /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/perl5.8/Portfile

Add platform support for darwin 13 (= Mac OS X Mavericks) through a new entry:

platform darwin 13 {
    # bypass stupid check that assumes fprintf must be in libc.dylib
    patchfiles-append   patch-hints_darwin.sh-usenm.diff
}

2.2.8 Install macport applications

sudo port install cmake
sudo port install gmake
sudo port install wget
sudo port install boost
sudo port install cgal
sudo port install ccache
sudo port install openmpi
sudo port install flex
sudo port install bison
sudo port install perl5.8
sudo port install rpm
sudo port install gcc_select
sudo port install python_select
sudo port install libgcc

2.2.9 Select your python version (choose one)

My choice was python26

port select --list python
sudo port select --set python python25
sudo port select --set python python26
sudo port select --set python python27

2.2.10 Select your gcc version (choose one)

My choice was gcc46

port select --list gcc
sudo port select --set gcc mp-gcc45
sudo port select --set gcc mp-gcc46

2.2.11 Set a symbolic link for mpirun and mpicc

sudo ln -s /opt/local/bin/openmpirun /usr/bin/mpirun
sudo ln -s /opt/local/bin/openmpicc /usr/bin/mpicc


Optional: Other useful applications

sudo port install ghc-bootstrap
sudo port install sqlite3
sudo port install zlib
sudo port install ghc
sudo port install apt-rpm
sudo port install tree
sudo port install qt4-creator-mac
sudo port install qt4-mac
sudo port install gnuplot

Optional: Show all installed ports incl. version number and category

port list installed


2.3 Paraview

2.3.1 Installation time

Less than 10min

2.3.2 Download ParaView from the website

Download ParaView-x.x.x-Darwin-64bit.dmg from the website (e.g. with version number x.x.x = 4.0.1):
http://www.paraview.org/paraview/resources/software.php

2.3.3 Make paraview easily accessible from the terminal

sudo ln -s /Applications/paraview.app/Contents/MacOS/paraview /usr/bin/paraview


2.4 OpenFOAM

2.4.1 Installation time

ca. 1h10min

2.4.2 Create a sparse disk image

Use Apple's 'Disk Utility' (in /Applications/Utilities) to create a case-sensitive sparse disk image (~/OpenFOAM.sparseimage) with the following settings

  • Save As: OpenFOAM
  • Name: OpenFOAM
  • Size: Custom (>10GB)
  • Format: Mac OS Extended (Case-sensitive,Journaled)
  • Encryption: none
  • Partitions: Hard disk
  • Image Format: sparse disk image

2.4.3 Pull the newest OpenFOAM-1.6-ext release

git clone git://git.code.sf.net/p/openfoam-extend/OpenFOAM-1.6-ext ~/OpenFOAM/OpenFOAM-1.6-ext

2.4.4 Execute the bashrc to get the environment variables

. ~/OpenFOAM/OpenFOAM-1.6-ext/etc/bashrc

2.4.5 Prepare the wmake rules according to your architecture

here: darwinIntel64Gcc

ln -s $WM_DIR/rules/darwinIntel64 $WM_DIR/rules/darwinIntel64Gcc

2.4.6 Edit general wmake rules

Open the general rules for wmake with

vim $WM_DIR/rules/darwinIntel64Gcc/general

and add the -P option in the first line

CPP        = cpp $(GFLAGS) -P

(from http://www.cfd-online.com/Forums/openfoam-installation/70318-wmake-error-file-make-linux64gcc44dpopt-objectfiles-could-not-created.html)

2.4.7 Download patches to support newer Mac OS X architectures

Note: Mac OS X Mavericks users need to edit those files and replace all entries for darwin12.5.0 with their own darwin13.x.x

wget -O $WM_THIRD_PARTY_DIR/rpmBuild/SOURCES/libccmio-2.6.1.patch_0 http://www.ifd.mavt.ethz.ch/people/grieserb/files/libccmio-2.6.1.patch_0
wget -O $WM_THIRD_PARTY_DIR/rpmBuild/SPECS/libccmio-2.6.1.spec http://www.ifd.mavt.ethz.ch/people/grieserb/files/libccmio-2.6.1.spec

(from http://www.cfd-online.com/Forums/openfoam-news-announcements-other/82587-extend-project-1-6-ext-binary-release-mac-os-x-2.html)

2.4.8 Edit the bashrc

Get the maximum number of parallel cores and use your system’s openmpi for compiling Third-Party libraries.
Open the bashrc with

vim $WM_PROJECT_DIR/etc/bashrc

and change the following content at the appropriate location

#: ${WM_NCOMPPROCS:=8}; export WM_NCOMPPROCS
export WM_NCOMPPROCS=`sysctl -n hw.ncpu`

and further down also the following

#: ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
export WM_MPLIB='SYSTEMOPENMPI'

2.4.9 Disable Paraview compilation

Open

vim $WM_THIRD_PARTY_DIR/AllMake

and comment the following line:

#./AllMake.stage4 
 

2.4.10 Compile the Third-Party applications first

$WM_THIRD_PARTY_DIR/AllMake 2>&1 | tee $WM_THIRD_PARTY_DIR/make1.log

And compile them again to check for potential errors

$WM_THIRD_PARTY_DIR/AllMake 2>&1 | tee $WM_THIRD_PARTY_DIR/make2.log

2.4.11 Edit the bashrc

Now edit the $WM_PROJECT_DIR/etc/bashrc again and set $WM_MPLIB back to OPENMPI

#: ${WM_MPLIB:=OPENMPI}; export WM_MPLIB
#export WM_MPLIB='SYSTEMOPENMPI'
export WM_MPLIB='OPENMPI'

2.4.12 Compile the OpenFOAM libraries and applications

$WM_PROJECT_DIR/Allwmake 2>&1 | tee $WM_PROJECT_DIR/make1.log

And compile them again to check for potential errors

$WM_PROJECT_DIR/Allwmake 2>&1 | tee $WM_PROJECT_DIR/make2.log

2.4.13 Edit your ~/.bashrc

Open or create your personal ~/.bashrc with

vim ~/.bashrc

and add the following entry

alias OF1.6-ext='hdiutil attach ~/OpenFOAM.sparseimage > /dev/null; . ~/OpenFOAM/OpenFOAM-1.6-ext/etc/bashrc'

2.4.14 New terminal

From now on, when you open a new terminal, load the OpenFOAM environment by simply typing the command

OF1.6-ext