1

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.

Billyziege
  • 56
  • 6
  • What version of `clang` does your machine have? – nrussell Mar 06 '16 at 22:20
  • Apple LLVM version 7.0.2 (clang-700.1.81) – Billyziege Mar 06 '16 at 23:01
  • It's generally difficult to use homebrew to correctly install R. Why are you not using the installer from CRAN? – IRTFM Mar 06 '16 at 23:53
  • Thanks so much. I've been working on this for days. I should have thought of installing from CRAN. – Billyziege Mar 07 '16 at 01:42
  • Aw c'mon @42-, that's oldschool FUD : http://rud.is/b/2015/10/22/installing-r-on-os-x-100-homebrew-edition/ – hrbrmstr Mar 07 '16 at 02:36
  • @Billyziege you needed to update all of homebrew after El Capitan (including R). Virtually any site talking homebrew and OS X stated that. If you did re-install/update everything R should have worked. I have one R system using official installers, one with homebrew and one with the Microsoft R binaries. All work fine. I rly wish ppl wld stop the FUD around non-"official" installers. – hrbrmstr Mar 07 '16 at 02:38
  • I'll certainly admit to "uncertainty". It's not clear from your writeup whether one needs to duplicate MacTex as a homebrew installation if you already have it installed. Ditto the RSudio install. What degree of "intelligence" does this method exhibit in the sense of determing whether existing resource will be "looked up". – IRTFM Mar 07 '16 at 03:23
  • @hrbrmstr I'll also echo the 42's uncertainty. Doing a search via google on "home-brew El Capitan upgrade", no link mentioned this. Links with solutions suggest the chown approach mentioned in the link on fixing developer tools after El Capitan upgrade in my initial post. After additional searching, I was able to find a single stack-overflow that supports reinstalling home-brew, but I also found a stack-overflow that supports the chown approach. My issue may be obvious to experienced developers, but they are not communicating on sites that less experienced people access. I'll reinstall. – Billyziege Mar 07 '16 at 16:38
  • That particular write up was to give instructions on using the homebrew approach in general (not for El Cap). And, "`homebrew el capitan`" in google provides a wealth of info on all kinds of issues & resolutions. – hrbrmstr Mar 07 '16 at 16:44

0 Answers0