如何使用brew链接到新的gcc版本?

时间:2014-05-17 06:37:26

标签: macos gcc homebrew

我通过运行brew updatebrew upgrade获得了新的gcc版本。 brew抱怨brew link没有成功完成:

~
✓  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 

所以我手动运行brew link gcc

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

现在,当我告诉brew清理时,我收到以下警告:

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

我的酒窖中有两个gcc版本:

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

我需要两者吗?我想删除旧版本。我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:14)

我通过运行以下命令解决了这个问题

brew unlink gcc
brew rm gfortran
brew cleanup
brew link gcc

似乎gfortran与旧的gcc版本相关联。