# Blog

Learning by doing.

# How to Compile STREAMER on Mac OSX?

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

## Intro

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.

### Note

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

http://fzhu2e.github.io/blog/mac/how-to-compile-streamer-on-mac-osx.html

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

Open the terminal and type in:

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

NOTE:

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:

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”:

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:

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

Then make soft links as

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:

or

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

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

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:

Then we untar the tarball,

We will see a directory called progs, cd into it

and we will see some makefiles.

Copy the Makefile.osx as 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 ([email protected]). ; )

Tags: Mac Compiling AOS