conda install -c psi4 gcc-5
One can also follow the instructions on GCC's homepage https://gcc.gnu.org/wiki/InstallingGCC after downloading the desired version
tar xzf gcc-VERSION.tar.gz
cd gcc-VERSION
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-VERSION/configure --prefix=$HOME/GCC-VERSION --enable-languages=c,c++,fortran,go
make
make install