Index: /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac-static.sh	(revision 25225)
+++ /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac-static.sh	(revision 25226)
@@ -10,8 +10,16 @@
 ## Environment
 #
-LIBGFORTRAN=$(mdfind -onlyin /usr -name libgfortran | grep -n libgfortran.a | grep -v i386 | sed "s/[0-9]*://g")
+
+# Find libgfortran and libgcc so we do not have to hardcode them
+#
+# NOTE: Assumes user installed gfortran via Homebrew
+#
+# TODO: Refactor this to work with other gfortran installations.
+#
+LIBGFORTRAN=$(mdfind -onlyin /usr -name libgfortran | grep -n libgfortran.a | grep -v i386 | sed "s/[0-9]*://g" | head -1) # Should retrieve a copy of gfortran that is compiled from source before returning one that is installed via package manager
 LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
+LIBGCC=$(mdfind -onlyin ${LIBGFORTRAN_ROOT} -name libgcc | grep -n libgcc.a | grep -v i386 | sed "s/[0-9]*://g" | head -1) # Should retrieve a copy of gfortran that is compiled from source before returning one that is installed via package manager
 
-export BLAS_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lfblas ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGFORTRAN_ROOT}/gcc/x86_64-apple-darwin15/9.3.0/libgcc.a" # Need to export BLAS_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
+export BLAS_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lfblas ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGCC}" # Need to export BLAS_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
 export BOOST_ROOT=${ISSM_DIR}/externalpackages/boost/install
 export DAK_BUILD=${DAK_ROOT}/build
@@ -19,5 +27,5 @@
 export DAK_SRC=${DAK_ROOT}/src
 export GSL_HOME=${ISSM_DIR}/externalpackages/gsl/install
-export LAPACK_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lflapack ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGFORTRAN_ROOT}/gcc/x86_64-apple-darwin15/9.3.0/libgcc.a" # Need to export LAPACK_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
+export LAPACK_LIBS="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lflapack ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGCC}" # Need to export LAPACK_LIBS *and* pass it as an option to CMake to ensure that external packages also find it
 
 # Cleanup
Index: /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac.sh	(revision 25225)
+++ /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac.sh	(revision 25226)
@@ -10,5 +10,13 @@
 ## Environment
 #
-LIBGFORTRAN=$(mdfind -onlyin /usr -name libgfortran | grep -n libgfortran.a | grep -v i386 | sed "s/[0-9]*://g")
+# Find libgfortran and so we do not have to hardcode it
+#
+# NOTE:
+# - Assumes user installed gfortran via Homebrew.
+# - Searches for libgfortran.a as it is easier to find it.
+#
+# TODO: Refactor this to work with other gfortran installations.
+#
+LIBGFORTRAN=$(mdfind -onlyin /usr -name libgfortran | grep -n libgfortran.a | grep -v i386 | sed "s/[0-9]*://g" | head -1) # Should retrieve a copy of gfortran that is compiled from source before returning one that is installed via package manager
 LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
 
