Talk:Installation/Outdated/Howto install OpenFOAM-1.6.x (git repository version)
From OpenFOAMWiki
I found that I had to use the OpenFOAM compiler, rather than system. Also, you don't specify to change . ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc in .bashrc, so running . etc/bashrc will only revert back to the original OpenFOAM-1.6 environment variables, which is why I changed that line.