From e5169f0b94fe959639cc4dab7149bb664ffd3367 Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Sat, 18 May 2024 09:11:39 -0400 Subject: [PATCH] fix(mac/gcc): just brew install --force --- setup-fortran.sh | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/setup-fortran.sh b/setup-fortran.sh index 086afa2..3bd07cd 100755 --- a/setup-fortran.sh +++ b/setup-fortran.sh @@ -27,27 +27,12 @@ install_environment_modules_apt() { install_gcc_brew() { - # check if gcc preinstalled via brew - current=$(brew list --versions gcc | cut -d' ' -f2) - current_major=$(echo $current | cut -d'.' -f1) - # if already installed, nothing to do - if [ "$current_major" == "$version" ]; then - echo "GCC $version already installed" - else - # otherwise install selected version - brew install gcc@${version} - fi - - # link the selected version, but first try unlinking both - # without and with specified version (cover case in which - # multiple versions are already installed and/or linked) - brew unlink gcc - brew unlink gcc@${version} - brew link gcc@${version} + brew install --force gcc@${version} + # make an unversioned symlink os_ver=$(sw_vers -productVersion | cut -d'.' -f1) - # default homebrew bin dir changed with macos 14 if (( "$os_ver" > 13 )); then + # default homebrew bin dir changed with macos 14 ln -fs /opt/homebrew/bin/gfortran-${version} /usr/local/bin/gfortran ln -fs /opt/homebrew/bin/gcc-${version} /usr/local/bin/gcc ln -fs /opt/homebrew/bin/g++-${version} /usr/local/bin/g++