Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mac/gcc): just brew install --force #96

Merged
merged 1 commit into from
May 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions setup-fortran.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down
Loading