Home > Back-end >  gcc-8: command not found (while installing randomForest)
gcc-8: command not found (while installing randomForest)

Time:07-23

I'm trying to install "randomForest" on R 3.6.3 as below:

urlPackage <- "https://cran.r-project.org/src/contrib/Archive/randomForest/randomForest_4.6-14.tar.gz"
install.packages(urlPackage, repos=NULL, type="source")

(install.packages('randomForest') throws the error: package 'randomForest' is not available (for R version 3.6.3))

The lines above, however, give me the following error:

    trying URL 'https://cran.r-project.org/src/contrib/Archive/randomForest/randomForest_4.6-14.tar.gz'
Content type 'application/x-gzip' length 80074 bytes (78 KB)
==================================================
downloaded 78 KB

* installing *source* package ‘randomForest’ ...
** package ‘randomForest’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -c classTree.c -o classTree.o
/bin/sh: gcc-8: command not found
make: *** [classTree.o] Error 127
ERROR: compilation failed for package ‘randomForest’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/randomForest’
Warning in install.packages :
  installation of package ‘/var/folders/66/3s4r17rx7ln0b1p8tyrmws780000gn/T//RtmpDOHynP/downloaded_packages/randomForest_4.6-14.tar.gz’ had non-zero exit status

Does anyone have any idea how to solve this? I'm on macOS Catalina (ver 10.15.7)

CodePudding user response:

You should install the gcc8 tool:

sudo port install gcc8

Related Links

  • Related