Mac安装gcc出现CommandLineTools

2019年10月18日 0 条评论 851 次阅读 0 人点赞

在用brew安装GCC时,出现如下错误:

brew install gcc

会出现以下错误

> $ brew install gcc
Updating Homebrew...
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
==> Installing dependencies for gcc: gmp, isl, mpfr and libmpc
==> Installing gcc dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.2_2.catalina.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/24/2409417943fceda33eac12a8229fbf7b990eee18ee341b543be575550a077bb0?__gda__=exp=1571379888~hm
######################################################################## 100.0%
==> Pouring gmp-6.1.2_2.catalina.bottle.1.tar.gz
🍺  /usr/local/Cellar/gmp/6.1.2_2: 18 files, 3MB
==> Installing gcc dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.21.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/1f/1f42c08dd84a2f418c8446be2679f027d8b1250d337b5e3135c401eba578cbb7?__gda__=exp=1571379901~hm
######################################################################## 100.0%
==> Pouring isl-0.21.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/isl/0.21: 72 files, 4.3MB
==> Installing gcc dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-4.0.2.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/14/140d29bfee0c8cf356fbb5391465f781df559e6076988de3ea8bcfd812f3c5bd?__gda__=exp=1571379931~hm
######################################################################## 100.0%
==> Pouring mpfr-4.0.2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/mpfr/4.0.2: 28 files, 4.7MB
==> Installing gcc dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.1.0.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libmpc-1.1.0.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/libmpc/1.1.0: 12 files, 361.9KB
==> Installing gcc
Warning: Building gcc from source:
  The bottle needs the Xcode CLT to be installed.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
  CompilerSelectionError: gcc cannot be built with any available compilers.
Install GNU's GCC:
  brew install gcc

看错误告诉我们是因为系统没有安装需要的CommandLineTools,这时我们需要以下命令更新xcode[安装可能会慢,根据当时的网络环境而定]

xcode-select --install

更新完成后在次安装gcc即可.

qianmoQ

qianmoQ

这个人太懒什么东西都没留下

文章评论(0)