cannot install package OpenMx in R

1.7k Views Asked by At

I'm running R version 3.5 on a mac. When I try to install OpenMx by

install.packages("OpenMx")

it eventually fails after a bunch of warning messages.

At first the warning message was

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

and found out this could be handled by running

xcode-select --install

on Terminal.

When I tried installing OpenMx after installing xcode,

the last several lines of messages are:

optimize.c:35:15: warning: unused function 'f_bound' [-Wunused-function]
static double f_bound(int n, const double *x, void *data_)
              ^
optimize.c:51:15: warning: unused function 'f_noderiv' [-Wunused-function]
static double f_noderiv(int n, const double *x, void *data_)
              ^
optimize.c:57:15: warning: unused function 'f_direct' [-Wunused-function]
static double f_direct(int n, const double *x, int *undefined, void *data_)
              ^
optimize.c:79:21: warning: unused function 'initial_step' [-Wunused-function]
static nlopt_result initial_step(nlopt_opt opt, const double *x, double *step)
                    ^
optimize.c:101:12: warning: unused function 'finite_domain' [-Wunused-function]
static int finite_domain(unsigned n, const double *lb, const double *ub)
           ^
5 warnings generated.
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include" -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rpf/include" -I/usr/local/include   -fPIC  -Wall -g -O2  -c options.c -o options.o
gfortran   -fPIC  -g -O2  -c sadmvn.f -o sadmvn.o
make: gfortran: No such file or directory
make: *** [sadmvn.o] Error 1
ERROR: compilation failed for package ‘OpenMx’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/OpenMx’
Warning in install.packages :
  installation of package ‘OpenMx’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/f8/y98w5w9n3yz3sq2pthhw35xm0000gn/T/RtmpJtQ01E/downloaded_packages’

Is there a way to fix this?

2

There are 2 best solutions below

0
On BEST ANSWER

install.packages("OpenMx") should just work for all platforms under R 3.5 It's possible you tried before CRAN had finished pushing out new binary builds for all platforms. Jut try again now.

If you want to build from source (not necessary) you would need to install the whole MacOS toolchain for R >= 3.4 provided at CRAN.

0
On

This is the key error message:

make: gfortran: No such file or directory

You need to install a gfortran compiler. You can find compilers and download/installation instructions here: https://gcc.gnu.org/wiki/GFortranBinaries.

(Note: This solution is also provided in response to a different R package, here.)