I upgraded my OS to El Capitan, and now when I issue an install package command in R like install.packages('MASS') I get the following error:
/usr/local/Cellar/r/3.2.3/R.framework/Resources/include/R_ext/Constants.h:33:10: fatal error: 'float.h' file not found
#include <float.h> /* Defines the rest, at least in C99 */
I have float.h in my standard c++ libs:
ls /usr/include/c++/4.2.1/tr1/float.h
/usr/include/c++/4.2.1/tr1/float.h
but R was installed by home-brew and is looking in the Cellar.
I thought that El Capitan's paths were not properly linked in R, so I uninstalled R, and reinstalled it. Now I am getting this error when I try to install packages I had on my old R installation (like ggplot2). I've looked at numerous posts about El Capitain breaking developer tools (like this one: https://ohthehugemanatee.org/blog/2015/10/01/how-i-got-el-capitain-working-with-my-developer-tools/), but nothing covering R.
Is this a problem with R or home-brew on El Capitan? Is there a way to tell R where to look for these headers? Any other suggestions would be very helpful too.
The full output of install.packages('MASS') is below:
trying URL 'https://cran.mtu.edu/src/contrib/MASS_7.3-45.tar.gz'
Content type 'application/x-gzip' length 487555 bytes (476 KB)
==================================================
downloaded 476 KB
* installing *source* package ‘MASS’ ...
** package ‘MASS’ successfully unpacked and MD5 sums checked
** libs
clang -I/usr/local/Cellar/r/3.2.3/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/op
In file included from MASS.c:18:
In file included from /usr/local/Cellar/r/3.2.3/R.framework/Resources/include/R.h:44:
/usr/local/Cellar/r/3.2.3/R.framework/Resources/include/R_ext/Constants.h:33:10: fatal error: 'float.h' file not found
#include <float.h> /* Defines the rest, at least in C99 */
^
1 error generated.
make: *** [MASS.o] Error 1
ERROR: compilation failed for package ‘MASS’
* removing ‘/usr/local/lib/R/3.2/site-library/MASS’
The downloaded source packages are in
‘/private/var/folders/rh/s75d4lws0fsg2xvw6jfj7sxw0000gp/T/Rtmp9lGxZ6/downloaded_packages’
Warning message:
In install.packages("MASS") :
installation of package ‘MASS’ had non-zero exit status
Edit: 42 pointed out CRAN's version of R is better than brew's. I uninstalled R (brew uninstall R) and downloaded and installed R from CRAN (http://cran.us.r-project.org) and it works now.
Edit2: In the comments, hrbrmstr points out home-brew needs a clean install after El Capitan upgrade. I have not tried this approach, but I wanted to point it out as an option that would probably work.