If you installed R from the installer on CRAN:
Download my compiled package from Dropbox and install it that way:
curl -O https://dl.dropboxusercontent.com/u/8859543/diversitree_0.9-7.tgz
R CMD INSTALL diversitree_0.9-7.tgz
This bundles everything that you need for diversitree, including GSL and FFTW for QuaSSE support.
First install GSL, Fortran, and FFTW (optional) using Homebrew:
brew install gsl gcc fftw
GSL and GCC are bottled so it should be as fast as your download speed. Compiling FFTW will take a while so you don't need to do it unless you need it for QuaSSE.
R thinks everyone has the same setup everywhere. So it'll look for gfortran-4.8
even though a perfectly servicable gfortran
is available. As far as I can tell there is no way to change this in R CMD INSTALL
using command line arguments. So instead we will hack into R's configuration files.
First confirm that gfortran
is installed and working:
gfortran --version
Then find out where GCC's libraries live:
gfortran -print-libgcc-file-name
I get /usr/local/Cellar/gcc/4.8.3/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/libgcc.a
; this might be different on your machine. You'll need this for later.
Now, edit R's configuration variables:
vim /Library/Frameworks/R.framework/Resources/etc/Makeconf ## or nano, mate, etc.
Edit the lines starting with FC
, F77
, and FLIBS
. Mine currently look like:
FC = gfortran-4.8
F77 = gfortran-4.8
FLIBS = -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm
Replace FC
and F77
with just gfortran
. Replace the long path after -L
in FLIBS
with the output of gfortran
from above, without the libgcc.a
bit at the end. Mine now look like:
FC = gfortran
F77 = gfortran
FLIBS = -L/usr/local/Cellar/gcc/4.8.3/lib/gcc/x86_64-apple-darwin13.2.0/4.8.3/ -lgfortran -lquadmath -lm
Now download and install the source tarball for diversitree:
curl -O http://cran.rstudio.com/src/contrib/diversitree_0.9-7.tar.gz
R CMD INSTALL diversitree_0.9-7.tar.gz
I hope you used Homebrew. Assuming the install of R went well (that is, brew install r
didn't vomit everywhere) and you didn't nuke your build setup in the meantime, you should just need to install gsl (brew install gsl
) and optionally fftw (brew install fftw
) and install.packages("diversitree")
should 'just work'.