Skip over navigation

Instructions to Install gfortran on Mac 10.5 to 10.7

Insert the install DVD or CD that came with your mac into the system. The following would open for an intel 10.5 computer.

Double click on the Optional Installs and move down to XcodeTools.mpkg.

Double click on the XcodeTools.mpkg to start the installation of the developer's packages.

Click on Continue. The next windows will ask you to read a license agreement and to choose the disk on which the software should be loaded. Check the Custom Install to check if the packages below will be installed.

Click on Install.

When the installation of the developer's tools is complete, download gfortan binaries for Mac OS 10.5 and 10.6 from

http://hpc.sourceforge.net/

Look down the web page for

Binaries:  gcc-snwleo-intel-bin.tar.gz (Snow Leopard), 
gfortran-snwleo-intel-bin.tar.gz (Snow Leopard gfortran only), 
updated January 2010 (Snow Leopard only).
gcc-leopard-ppc-bin.tar.gz (Power PC),
gfortran-leopard-ppc-bin.tar.gz (PowerPC gfortran only),
gcc-leopard-intel-bin.tar.gz (Intel Mac),
Gfortran-leopard-intel-bin.tar.gz (Intel Mac gfortran only), 
updated June 2009 (Leopard only).

Download the binaries appropriate for your computer.

When the file is downloaded to your Mac, the file will be gunzip'ped and will appear as gfortra...tar where your files are normally downloaded.

Open a terminal window. The terminal window program is found in /Application/Utilities. In the terminal window change to the directory where the download gfortran program resides. Move the tar file to / and untar it. The files will be unloaded into subdirectories under /usr/local. In the example below I sent my download file to my Desktop. I also am using a 10.5 Intel mac in the example. I used several spaces below to indicate where one blank space should occur.

$ cd Desktop
$ sudo mv gfor*.tar /
$ cd /
$ ls
$ sudo tar -xvf gfortran-leopar*.tar

You will see gfortan being moved to /usr/local/bin and other files being moved to /usr/local/lib and /usr/local/include.

Add /usr/local/bin to your search path by editing /etc/bashrc. I use the vi editor.

$ sudo vi /etc/bashrc

Add the folowing line:

export PATH=$PATH:/usr/local/bin

You will have to open a new terminal window to have the new defined path.

Test using:

which gfortan
/usr/local/bin/gfortran
gfortran
gfortran: no input files

Explantion of some of the unix steps used above:

"sudo" is used to give your account privileges above your normal privileges. Your account becomes a "super user" for the one command. Use "sudo" carefully.

"tar -xvf" says to extract (x) from the tar file. "v" says to use the verbose mode indicating everything that is being extracted and where it is going. "f" says the filename of the file to be used follows immedately.

"gzip" is a compression program which adds ".gz" to the end of a file. Downloads to Macs are automatically "gunzip'ed" or uncompressed.


Margaret Doll 3/2/2010