我使用brew install gcc
这在/usr/local/Cellar/gcc/6.3.0_1/bin/gcc-6
但是,命令ggc -v
返回:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
仍然是xcode的默认“gcc”,这真的很铿锵。所以我需要将gcc链接到gcc-6。我试过了brew link gcc
。任何意见都表示赞赏!
编辑:echo $PATH
如果有帮助则返回/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
答案 0 :(得分:2)
解决!
将usr/local/bin
添加到$ PATH的前面,然后ln -s gcc-6 gcc