Skip to content

Commit 0e08b7d

Browse files
authored
fix(mac/gcc): just brew install --force (#96)
1 parent 9878707 commit 0e08b7d

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

setup-fortran.sh

+3-18
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,12 @@ install_environment_modules_apt() {
2727

2828
install_gcc_brew()
2929
{
30-
# check if gcc preinstalled via brew
31-
current=$(brew list --versions gcc | cut -d' ' -f2)
32-
current_major=$(echo $current | cut -d'.' -f1)
33-
# if already installed, nothing to do
34-
if [ "$current_major" == "$version" ]; then
35-
echo "GCC $version already installed"
36-
else
37-
# otherwise install selected version
38-
brew install gcc@${version}
39-
fi
40-
41-
# link the selected version, but first try unlinking both
42-
# without and with specified version (cover case in which
43-
# multiple versions are already installed and/or linked)
44-
brew unlink gcc
45-
brew unlink gcc@${version}
46-
brew link gcc@${version}
30+
brew install --force gcc@${version}
4731

32+
# make an unversioned symlink
4833
os_ver=$(sw_vers -productVersion | cut -d'.' -f1)
49-
# default homebrew bin dir changed with macos 14
5034
if (( "$os_ver" > 13 )); then
35+
# default homebrew bin dir changed with macos 14
5136
ln -fs /opt/homebrew/bin/gfortran-${version} /usr/local/bin/gfortran
5237
ln -fs /opt/homebrew/bin/gcc-${version} /usr/local/bin/gcc
5338
ln -fs /opt/homebrew/bin/g++-${version} /usr/local/bin/g++

0 commit comments

Comments
 (0)