Wednesday, December 23, 2009

Step-by-step procedure of building MacPorts gfortran and AmberTools 1.3 in Mac OS X 10.6

This is what I would do if I got a brand new Mac OS X machine using gfortran to build AmberTools 1.3 on it.

  1. Find the Mac OS X installation CDs/DVD, start to install Xcode Developer Tools.
    If you left it at home, try to download it at the Apple Developer Connection site. Make sure you have installed "Unix Development" (default)
  2. Download the MacPorts Disk Image from the MacPorts' website.
  3. 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.
  4. 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.
  5. check if your PATH environment variable really contains /opt/local/bin and /opt/local/sbin by running "echo $PATH"
  6. check upgrades to MacPorts: "sudo port -v selfupdate"
  7. run "sudo port install gcc44"
  8. run "mkdir ${HOME}/bin"(not necessary)
  9. append this line to the end your ~/.bashrc (If you are using CSH/TCSH, you must be very savvy, so you don't need no documentation...
    export PATH=${HOME}/bin:$PATH
  10. run "export PATH=${HOME}/bin:$PATH"
  11. run "ln -s /opt/local/bin/gfortran-mp-4.4 ~/bin/gfortran"
    (Original steps were stupid, try following steps:) run "sudo port install gcc_select; sudo gcc_select mp-gcc44"
  12. Download AmberTools from http://ambermd.org/#AmberTools (Safari will place it to ~/Downloads)
  13. run "tar jxvf ~/Downloads/AmberTools-1.3.tar.bz2 -C ~/", this will extract an amber11 folder in your home directory.
  14. Now it would be a good time to append this line to your ~/.bashrc
    export AMBERHOME=${HOME}/amber11
  15. run "export AMBERHOME=${HOME}/amber11" as well
  16. run "cd ~/amber11/src; ./configure -macAccelerate gnu"
  17. run "make -f Makefile_at" and wait
  18. After "make" stops, check to see if there is any error. If your building process indeed stopped prematurely, report it to the Amber mailing list. Please mention your OS version and compiler you used.
  19. run "cd ~/amber11/test; make -f Makefile_at" to check the testing cases result. Please make sure your environment variable $AMBERHOME is correct before you run the test.

After thought

If you want to use macports without problem after above operation, make sure to "sudo gcc_select" back to gcc42 or llvm-gcc42, or you might encounter some incompatibility with building some certain ports.