A couple of days ago I just found out that when you install R with Homebrew you don’t get all the capabilities that the binary from CRAN have. In other words, you have a kind of second class install, in some regards, and depending on how you do install and for what you are going to use R.


1
2
3
4
5
6
7
8

>capabilities()

jpeg         png        tiff       tcltk         X11        aqua
FALSE       FALSE       FALSE       FALSE       FALSE        TRUE
http/ftp     sockets      libxml        fifo      cledit       iconv
TRUE        TRUE        TRUE        TRUE        TRUE        TRUE
NLS     profmem       cairo         ICU long.double     libcurl
TRUE        TRUE       FALSE        TRUE        TRUE        TRUE



1
2
3
4
5
6
7

>capabilities()
jpeg         png        tiff       tcltk         X11        aqua
TRUE        TRUE        TRUE        TRUE        TRUE        TRUE
http/ftp     sockets      libxml        fifo      cledit       iconv
TRUE        TRUE        TRUE        TRUE        TRUE        TRUE
NLS     profmem       cairo         ICU long.double     libcurl
TRUE        TRUE        TRUE        TRUE        TRUE        TRUE



How did I notice? Well basically I was about to update the sm package in one of my computers and R yield an error similar to this one (sorry I didn’t copy the original one):


1
2
3
4
5
6

Error: package or namespace load failed for ‘tcltk’:
call: fun(libname, pkgname)
error: Tcl/Tk support is not available on this system
S3 methods ‘as.character.tclObj’, ‘as.character.tclVar’, ‘as.double.tclObj’, ‘as.integer.tclObj’, ‘as.logical.tclObj’, ‘as.raw.tclObj’, ‘print.tclObj’, ‘[[.tclArray’, ‘[[<-.tclArray’, ‘$.tclArray’, ‘$<-.tclArray’, ‘names.tclArray’, ‘names<-.tclArray’, ‘length.tclArray’, ‘length<-.tclArray’, ‘tclObj.tclVar’, ‘tclObj<-.tclVar’, ‘tclvalue.default’, ‘tclvalue.tclObj’, ‘tclvalue.tclVar’, ‘tclvalue<-.default’, ‘tclvalue<-.tclVar’, ‘close.tkProgressBar’ were declared in NAMESPACE but not found



As you can see I’ve highlighted the key line, R doesn’t have tcltk available and running in that system and if you run capabilities() in the R console you’ll probably get something similar to the first code-block. After researching a little bit about the problem [1 & 2], I found out what I’ve already said, Homebrew R isn’t build with those capabilities. Why? Well…

1. It seems that those capabilities are optional when you build R from source and build R with those capabilities / options on Homebrew’s bottle server is “error prone”.
2. To have some of the missing capabilities you must have in your system X11/XQuartz, which isn’t installed in every Mac, because it’s not longer provided as macOS basic installation.
3. You can install X11/XQuartz, but you have to do it with Homebrew Cask, since it can’t be build from source. As a consequence is a off project dependency and they don’t want to rely on that.
4. Homebrew seems to be heading to a option-less direction where the formulas aren’t going to have any option at all. So if you want to have options or different kind of build they encourage you to have your own tap.

Whether you agree or not, you have to understand that the maintainers of Homebrew-core took this direction for a reason, which is probably they have already too much work to do. Don’t forget they maintain the package manager for free. If you disagree, as I do, at least partly, please be polite. A lot of users have been expressing their disagreement in really bad manners lately and that is not acceptable.

Lucky for us users, there is a solution to the problem. You can always create your own tap of Homebrew and tweak the formula to fit your needs, as maintainers suggest. As a result someone already did that and there is already a tap which you can install R with the same formula we installed R when it was in Homebrew Science, but up to day.

I’ll explain in my next post how to install R using that tap.

Tags:

Categories:

Posted: