9

I just got a new gcc version by running brew update and brew upgrade. brew complained that brew link did not complete successfully:

~
✓  brew upgrade
==> Upgrading 1 outdated package, with result:
gcc 4.8.2_1
==> Upgrading gcc
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gcc-4.8.2_1
######################################################################## 100,0%
==> Pouring gcc-4.8.2_1.mavericks.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using:
  brew link gcc

Possible conflicting files are:
/usr/local/bin/gfortran -> /usr/local/Cellar/gfortran/4.8.2/bin/gfortran
/usr/local/share/man/man1/gfortran.1 -> /usr/local/Cellar/gfortran/4.8.2/share/man/man1/gfortran.1 

So I ran brew link gcc manually:

~
✓  brew link gcc
Linking /usr/local/Cellar/gcc/4.8.2... 25 symlinks created

Now when I tell brew to clean up I get the following warning:

~
✓  brew cleanup
Warning: Skipping (old) /usr/local/Cellar/gcc/4.8.2 due to it being linked

There are two gcc version in my Cellar:

~
✓  ls /usr/local/Cellar/gcc
4.8.2   4.8.2_1

Do I need both? I would like to remove the old version. How can I achieve that?

IKavanagh
  • 6,089
  • 11
  • 42
  • 47
Jan Deinhard
  • 19,645
  • 24
  • 81
  • 137

1 Answers1

16

I solved it by running the following commands

brew unlink gcc
brew rm gfortran
brew cleanup
brew link gcc

It seems that gfortran was linked to the old gcc version.

Jan Deinhard
  • 19,645
  • 24
  • 81
  • 137
  • 2
    It's a very old post, but you can't link a library that is not installed and the rm gfortran basically removes the gcc library as the two are linked. Perhaps this was not the case in 2014. – Andrea Moro Jan 08 '21 at 16:35