University of Washington | College of the Environment | School of Oceanography | Physical Oceanography

What's New?

Parker MacCready: ROMS Macintosh Notes

10/11/2011 I am keeping this around only for historical reference. It exists on the ROMS site now, and that would be the best place to send updates:

10/1/2008: This is explicit instructions for getting ROMS to run on my new MacBook Pro (running Mac OS X 10.5.4, Darwin 9.4.0). It is meant as a cookbook for people who want to run ROMS, but who (like me) are behind the times in understanding all the mechanics of how compilers run these days. I got a LOT of help from Rob Hetland. Thanks Rob!

NOTE: most of these steps need to be done in the order given (e.g. you need Xcode to have the installation of gfortran be right, and you need gfortran to make NetCDF)

NOTE: I use $ to mean the prompt in the mac Terminal; you don't type this as part of the command.

1. Xcode

Get the Apple Developers Tools Xcode, from, go to Xcode 3: free download. I got version 3.1.1 and followed the standard installation (this means that it will install itself when you click on it, and you just need to click to accept a few defaults). To download this you need to sign up as an ADC member, but if you already have an Apple account (e.g. for iTunes) then you can use that. It is free. Caution: the download is about 1 GB.

2. gfortran

Get gfortran-4.2.3.dmg (the GNU Fortran compiler) from and follow the standard installation. Now when I am in the Mac Terminal and execute "$which gfortran" it returns /usr/local/bin/gfortran.

3. make

NOTE: you may not need to do this if you already have make 3.8.1. Try "$make -- version" to find out.

Get make-3.8.1.tar.gz from Create the directory ~/src (~ is your home directory, which on my machine is /Users/PM). Put the tar file into ~/src (note that the Mac download tool already gets rid of the ".gz"), and then extract it by executing "$tar xvf make-3.8.1.tar". Next, go into the new directory make-3.8.1 and execute the following three commands:



$sudo make install

4. perl

I didn't have to do anything to get this, as it already appears to exist in /usr/bin/perl.

5. NetCDF

Download netcdf-3.6.3.tar.gz from (down on the lower right part of the page). This is the source code for NetCDF 3, which you are going to compile on your machine using gfortran, the same compiler you will use for compiling ROMS. You could also move up to NetCDF 4, but this requires installing HDF and some other code which I did not want to bother with at this time, but it would be easy to do in the future. Put the tar file in ~/src, extract it, and go into the directory "netcdf-3.6.3" that is created. Also, make sure that the directory /opt exists on your machine (it did on mine). Then execute:

$export FC=gfortran

$export FFLAGS='-O3' (NOTE: that is a capital letter "o", not a zero)

$./configure --prefix=/opt/netcdf3/gfortran


$sudo make install

$make check (and it will then run through a check sequence)

5.1 NetCDF Addendum from Sally Warner May 2010; She writes:

My operating system is OSX 10.6.3. I think this error arose due to a conflict between 32 and 64 bit architecture.

I came across a problem installing netcdf on my computer. I was following the instructions on your roms_mac_notes page. When I used the command './configure - prefix=/opt/netcdf/gfortran/', I was getting the error:

checking if Fortran "byte" is C "signed char"... configure: error: Could not link conftestf.o and conftest.o

I found the solution on this website:

By executing the command

export CFLAGS='-m32'

before the ./configure command, I was successfully able to install netcdf.

6. svn

Get subversion 1.5.2-2 from and follow the standard installation.

7. Get ROMS source code and modify the make file

Create the directory ROMS (a home for the source code). Then cd to that directory and excute:

$svn checkout --username [your ROMS account username] .

NOTE: It will ask for your ROMS account password.

Now you have to fiddle with the makefile. What I did was, in the directory ~/ROMS/Compilers:


And then edit the approproate lines in (the ones in the "else" category in the "ifdef USE_NETCDF4" section) so that they read:

NETCDF_INCDIR ?= /opt/netcdf3/gfortran/include

NETCDF_LIBDIR ?= /opt/netcdf3/gfortran/lib

Also edit ~/ROMS/makefile to have FORT ?= gfortran (instead of pgi)

8. Make and run!

Now when you are in ~/ROMS you just execute

$make (this creates the executable oceanS)

and then to run the upwelling example you just type

$./oceanS < ROMS/External/ > log & (and now it is running, as you are "escaped back to shell")


As ROMS runs you can check its progress by typing $tail log, or $tail -f log to get a streaming log.

ROMS creates the files, and _dia, _his, _rst, and log

I like to develop MATLAB tools which call SNCTOOLS commands to look at things.