Installation of Code_Saturne on Mac OS X

Tiger (10.4):

To install Code_Saturne on a Mac, you need the following requirements:

  • Python (for the installer script)
  • C compiler. The C compiler is within the CD that comes with the Macbook, under dev tools.
  • FORTRAN compiler. You need a compiler that will work with your C compiler. I used g77 from here
  • The current version of Code_Saturne including the kernel, the pre-processor and the fvm and bft libraries. See the main page for download links.
Optionally you can use:
  • CGNS format reader.
  • libxml2 to use the xml files generated by the graphical interface. This can be installed used MacPorts or fink, or compile it from source.
  • mpi implementation if you want to use more than one core. There are several implementations such as mpich, lam/mpi and openMPI. Here I use openMPI.

There are two ways to install Code_Saturne:

  1. Automatic installation.
  2. Installation from source.

It is my personal view that you should install from source since in that way you can be familiar with the packages that are installed and you will be able to update them very easily. This also has the problem that requires a bit longer and a bit of tinkering and patience.

Automatic installation of version 1.3.2

If you don't want to do that, you can download the zipped file here and go through a automatic configuration and compilation of the packages. I have created this packaged based on the following versions:

Kernel 1.3.2
Preprocessor 1.3.2
bft 1.0.6
fvm 0.10.0
metis 4.0
openMPI 1.2.6
libxml2 2.6.28
cgns 2.4

First you need to install the compiler as described above, it is important that you have a fortran compiler tha can link with the c compiler, otherwise you won't get very far. In Tiger, there is a problem with the gcc 4.x compiler. To get around it you can either go to the previous version 3.x or edit the file /usr/include/netdb.h by commenting some lines. Your file should look like:

      struct  hostent {
       char    *h_name;    /* official name of host */
       char    **h_aliases;    /* alias list */
       int h_addrtype; /* host address type */
       int h_length;   /* length of address */
       char    **h_addr_list;  /* list of addresses from name server */
   +++ #ifndef _POSIX_C_SOURCE
       #define h_addr  h_addr_list[0]  /* address, for backward compatiblity */
   +++ #endif /* !_POSIX_C_SOURCE */
Comment the lines with the +++ and it should work (see here for more info).

Once you have done that you can download the file into the location where you want to install it and type:

tar xfvz Code_Saturne_1.3.2.tar.gz

This will create the directory structure needed with the source packages under src.

Go to the Install directory and type:


This will launch the installer that will compile all the packages and install them into CS_HOME/opt. Then it will compile and install the preprocessor and the kernel. This compilation takes a while, specially compiling the OpenMPI package.

Tar file

I have now created a tar file to be installed on /usr/local/ so all you need to do is untar it there and it should work. If anybody wants to try it, please let me know how it works. I know it links under Leopard but needs more thorough testing.

Please be aware that you will need the g77 and gcc compilers described above.

Leopard (25/02/2009):

  • With Leopard, fortran compiler has to be used with -gdwarf-2 instead of -g. Ref.
  • ncs-1.4.0 and ecs-1.4.0 successfully installed on a MBP + Leopard, with bft-1.0.8, fvm-0.12.0 and openmpi-1.3, but SOCKET=1 does not work. No tests in parallel so far. Flavien Billard - 25 Feb 2009

Snow Leopard (10.6.4)

Code_Saturne v2.0rc2 now works in Snow Leopard (10.6.4) in parallel and with the graphical interface. MEI is not working yet.

To get everything working you will need several packages from Macports:

  • gcc and gfortran ( I used gcc version 4.2.1 (Apple Inc. build 5659) )
  • Qt4
  • python, pyqt4
  • openmpi
  • metis

Unfortunately, the PyQt4 port does not include the development packages, so if you want to have the graphical interface you need to install it by hand. This is very easy, just download the source file ( and follow the instructions on the README you might need to install a package called SIP from the same website. Same instructions ( python and then make and make install)

Remember that you will need root access to install all in the macports location (/opt/local)

Once you have all the ports installed, you need to modify the file to include --disable-shared. I also had a problem with the gfortran and c compilers trying to use 64 and 32 bits so I had to force them to use 64 bit by adding CFLAGS=-m64 FCFLAGS=-m64 to the options of the kernel (NCS). See the attached file with the modifications included.

You can also have a look at the setup file I used.

In order to run in parallel, you need a version of mpi. I used openmpi @1.4.2 from Macports. This installation creates openmpicc, openmpif90 and openmpirun in /opt/local/bin. If you use this ones you will need to modify the file runcase_mpi_env in $CS_ROOT/cs-2.0-rc2/share/ncs to force the code to use openmpirun rather than mpirun. Just change the line 103 to = MPIRUN="openmpirun -np ${NUMBER_OF_PROCESSORS}"=.

To do:

  • Install cgns support.
  • Install MEI. Currently configure complains saying that I need a version >=1.3 but I have 2.0!!

  • Code_Saturne on Mac OSx:
-- JuanUribe - 2010-07-16

Current Tags:
create new tag
, view all tags
Topic attachments
I Attachment Action Size Date Who Comment
elsegz Code_Saturne_1.3.2.tar.gz manage 66923.9 K 2008-05-01 - 09:59 JuanUribe Code_Saturne_1.3.2.tar.gz for Mac
elsegz Code_Saturne_1.3.2_MacOS.tar.gz manage 81146.1 K 2008-08-06 - 11:16 JuanUribe Saturne for Mac OS to untar on /usr/local/
pngpng Screen_shot_2010-07-15_at_18.23.21.png manage 744.7 K 2010-07-15 - 16:57 JuanUribe Code_Saturne on Mac OSx
else0rc2 install_saturne.py_v2.0rc2 manage 39.3 K 2010-07-15 - 16:59 JuanUribe Modified install script for Mac OS x
else0rc2 setup_v2.0rc2 manage 5.5 K 2010-07-15 - 17:00 JuanUribe set up file for v2.0rc2 Mac OSx
Topic revision: r7 - 2010-07-16 - 10:45:12 - JuanUribe
Saturne Web
06 Aug 2020
Test Cases

tip Saturne Tip of the Day
Channel flow statistics
Channel flow statistics have been developed and implemented for Code Saturne Version 1.3.1 RichardHoward ... Read on Read more


Code_Saturne collaborative website
@ the University of Manchester
Copyright & by the contributing authors. Unless noted otherwise, all material on this web site is the property of the contributing authors.