Step-by-step building MacPorts gfortran and AmberTools 1.4 in Mac OS X 10.6
http://amberonmac.blogspot.com/2009/12/step-by-step-procedure-of-macports.html http://amberonmac.blogspot.com/2010/04/step-by-step-ambertools-14-installation.html
This is what I would do if I got a brand new Mac OS X machine using gfortran to build AmberTools 1.4 on it.
- Install Xcode Developer Tools from Mac OS X DVD or download it at the Apple Developer Connection site (Apple ID is needed). Make sure you have installed "Unix Development" (default).
Download the MacPorts 1.9.1 Disk Image or newer (http://distfiles.macports.org/MacPorts/) from the MacPorts' website.
- Mount the disk image and install the pkg, running the system's Installer by double-clicking on the pkg contained therein, following the on-screen instructions until completion.
- Open a new shell window and do later stuff in this shell, this is to make sure that changes to the environment variables have taken effect.
- check if your PATH environment variable really contains /opt/local/bin and/opt/local/sbin by running "echo $PATH"
check upgrades to MacPorts:
sudo port -v selfupdate
- run:
sudo port install gcc44
- append this line to the end your ~/.bashrc
export PATH=${HOME}/bin:$PATH
- run:
export PATH=${HOME}/bin:$PATH
- run:
sudo port install gcc_select
- run:
sudo gcc_select mp-gcc44
- Remember!!! If your other compiling activities are broken by gcc_select, for example you no longer are able to build iphone app with Xcode, just do "sudo gcc_select gcc42" to reset the setting.
Download AmberTools from http://ambermd.org/#AmberTools (Safari will place it to ~/Downloads)
- Change the current directory to /usr/local:
cd /usr/local
Then extract the AmberTools archive you just downloaded, presumably at ~/Downloads/:
sudo tar xvfj ~/Downloads/AmbeTools-1.4.tar.bz2
- And then fix the permission for you can build it without using root privilege:
sudo chown -R $USER:$GROUP amber11
- Run this command and make sure to put this command to your $HOME/.bashrc:
export AMBERHOME=/usr/local/amber11
- Change the current directory to where the configure script is:
cd amber11/AmberTools/src
- Now it would be a good time to modify the configure script if you are required to do that because of this and that. THIS IS NORMALLY NOT NECESSARY.
perl -pi -e 's/cc=gcc/cc=gcc-4/;s/g++/g++-4/g' configure
- Following the manual, do the configuration. This takes about 1~3 minutes to finish.
./configure -macAccelerate gnu
- And start to build the program:
make install
- After that, change your current directory to the testing directory:
cd ../test
- And start testing!
make test
Building a parallel version
After finish building the AmberTools above, you might want to build a parallel version of some commands. About the decision of whether or not making a parallel version of them, please refer to the AmbetTools manual. If you want to build parallel version of AmberTools 1.4 or even Amber11 in general I'd recommend to build an openmpi software by yourself under the AMBER directory. Here is how to build an openmpi inside AMBER.
First change current directory to the AmberTools source: cd $AMBERHOME/AmberTools/src
- Important! Clean-up the left-over from previous non-parallel building work. make clean
- Then download the source code of openmpi from here and extract the files for openmpi. tar xvfj ~/Downloads/openmpi-1.4.1.tar.bz2
- Now start to build the openmpi:
- /configure_openmpi gnu
- Here comes the tricky part, by default your Mac OS X 10.6/10.5 bundled openmpi with the developer Tools without FORTRAN support (yes, sadly mpif90/mpif77 in the /usr/bin are disabled by Apple.), so you have to make sure $AMBERHOME/bin in the PATH and also it has to be prior to /usr/bin. If you have macports installed, your $PATH in the BASH should look something similar to this: bash-3.2$ echo $PATH /usr/local/amber11/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/X11/bin bash-3.2$
Now configure a parallel environment for building parallel commands in AmberTools: env MPI_HOME=$AMBERHOME/AmberTools ./configure -mpi -macAccelerate gnu
- And then build the things: make parallel
- Before you do some tests on parallel programs, be advised to turn off the firewall (consider this temporary), since the tests will give you a lot of pop-up prompts if you are using application based firewall rules...
- And do some tests: cd ../test env DO_PARALLEL="mpirun -np 2" make test.parallel Now you have it! If you still do not know what you are doing, please stop-by the Amber mail reflector and ask us questions and we are more than happy to help!