Learning by doing.

How to Compile STREAMER on Mac OSX?

Feb 24, 2015 • Mac • Tags: Mac Compiling AOS


This is a tutorial about how to compile STREAMER, a radiative transfer model, for the STREAMER project in course AOS 640 taught by Prof. Grant Petty.


In case my domain changes, below is the long-term URL for this post:

Step 1. Check if the “Xcode command line tools” is installed.

Open the terminal and type in:

xcode-select --install

If we haven’t installed the tools, a prompt will poped out and just click “install”.


  1. We don’t have to install the whole package of “Xcode”, we just need the “command line tools”.

  2. The root authority is needed.

To verify the installation:

xcode-select -p

If the terminal returns as below, then we have installed successfully.


Step 2. Get the latest version of GCC.

Mac OS X should be installed with GCC as default, I haven’t checked if that is OK for our compiling task (should be OK). I compiled with the latest versioin of gfortran, which is bundled in the GCC package.

I recommend you guys a lovely package manager called “Homebrew”. We can conveniently install the latest version of GCC by it.

To install “Homebrew”:

ruby -e "$(curl -fsSL"

NOTE: The admin authority is needed by default. Alternatively, we can install it under our home directory.

Then install the latest version of GCC by:

brew update
brew install gcc

Edit the ~/.bash_profile (for Bash users) or ~/.zshrc (for Zsh users), add the PATH for GCC, for example:

export PATH=/usr/local/Cellar/gcc/4.9.2_1/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9:$DYLD_LIBRARY_PATH

Then make soft links as

ln -sf /usr/local/Cellar/gcc/4.9.2_1/bin/gcc-4.9 /usr/local/Cellar/gcc/4.9.2_1/bin/gcc
ln -sf /usr/local/Cellar/gcc/4.9.2_1/bin/g++-4.9 /usr/local/Cellar/gcc/4.9.2_1/bin/g++
ln -sf /usr/local/Cellar/gcc/4.9.2_1/bin/c++-4.9 /usr/local/Cellar/gcc/4.9.2_1/bin/c++
ln -sf /usr/local/Cellar/gcc/4.9.2_1/bin/cpp-4.9 /usr/local/Cellar/gcc/4.9.2_1/bin/cpp
ln -sf /usr/local/Cellar/gcc/4.9.2_1/bin/gfortran-4.9 /usr/local/Cellar/gcc/4.9.2_1/bin/gfortran

Note that 4.9.2_1 is the version I used, and it may not be the one you are using, so please check the version number and make sure the paths you typed in do exist.

Then source the file you just editted:

source ~/.bash_profile


source ~/.zshrc

To verify the installation of GCC, in the terminal we type in:

gcc -v

we can get the return and know the version number. Also, we can verify the gfortran:

gfortran -v

Actually, gfortran is what we need to compile the STREAMER program.

Step 3. Edit the Makefile under the STREAMER progs directory and compile.

Once we have installed gfortran, we are ready to compile the STREAMER program on OS X.

First download the tarball of STREAMER,


wget is a command line download tool. If it has not been installed yet, we can install it by:

brew install wget

Then we untar the tarball,

tar -xvf streamer.tar

We will see a directory called progs, cd into it

cd progs

and we will see some makefiles.

Copy the Makefile.osx as Makefile:

cp Makefile.osx Makefile

Then modify the value of the variable FC from g77 to gfortran. Now compile the program by typing in the below command in the terminal


If the compiling is successful, we will get an executable file named as streamer under the progs directory.

What questions do you have?

If you have any questions, feel free to contact me ( ; )

Tags: Mac Compiling AOS