2

Trying to install the Rcmdr (R version 3.2.2) package in my Mac (Yosemite 10.10.4), I ran into a few problems:

  1. After I installed Rcmdr with all its dependencies I get the following when I try to load the package:

Loading required package: RcmdrMisc
Loading required package: car
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘quantreg’ Error: package ‘car’ could not be loaded

  1. So I tried to install the car package along with its dependency, the quantreg package, and this is what happens:

** package ‘quantreg’ successfully unpacked and MD5 sums checked ** libs gfortran-4.8 -fPIC -g -O2 -c akj.f -o akj.o
make: gfortran-4.8: No such file or directory
make: *** [akj.o] Error 1
ERROR: compilation failed for package ‘quantreg’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/quantreg’
Warning in install.packages :
installation of package ‘quantreg’ had non-zero exit status

  1. Then I realized the problem might be the fortran compiler. I don't have the 4.8 version, but I did a symlink for gfortran-4.8 to my gfortran-5.0 and yet I couldn't solve the problem:

ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [quantreg.so] Error 1
ERROR: compilation failed for package ‘quantreg’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/quantreg’

I would be very grateful if someone could help me get to the bottom of this problem.

lmo
  • 37,904
  • 9
  • 56
  • 69
uller
  • 115
  • 2
  • 10
  • which version of R are you running? – scribbles Aug 21 '15 at 14:28
  • Have you tried this? http://stackoverflow.com/questions/23916219/os-x-package-installation-depends-on-gfortran-4-8 –  Aug 24 '15 at 03:08
  • I tried that before but the URL for the gfortran-4.8 was down. I tried again and, oddly enough, it worked! Thanks :) – uller Aug 24 '15 at 11:35

1 Answers1

1

Here is how I solved it. [OSX Mojave, R 4.0.2]

I hope it helps, especially for those who could not solve it with the answers provided here: OS X package installation depends on gfortran-4.8

  1. Make sure R is updated to version >= 4.0 (for previous versions this might help: https://cran.ism.ac.jp/bin/macosx/tools/)

  2. Download and install the GNU fortran compiler found here: https://mac.r-project.org/tools/

  3. Make sure you add /usr/local/gfortran/bin to your PATH in order to use this compiler. This can be done, e.g. by

export PATH=$PATH:/usr/local/gfortran/bin