Install R with MacPorts

If you are looking to install R using MacPorts, `port search R` will return 17844 possibilities, only one of which is R itself and three of which are related to R. If you use `port help search` you will see that there is a better way to search:

port search –exact R
R @3.1.0_1 (math, science)
R is GNU S – an interpreted language for statistical computing

The you need to do nothing more than:

sudo port install R

MacPorts will determine the dependencies:

—> Computing dependencies for R
—> Dependencies to be installed: gcc48 icu jpeg pango Xft2
gobject-introspection libtool harfbuzz graphite2 pkgconfig
readline tiff xorg-libXt xorg-libsm xorg-libice

After that, if you are using Matthew Jockers’ excellent _Text Analysis With R
for Students of Literature_, you should install [RStudio][]. (I don’t find it as useful as iPython’s notebook, but it is a handy all-in-one GUI.)


3 thoughts on “Install R with MacPorts

  1. How can I specify a particular version of gcc while installing R using port? My install fails on Mac OS X 10.11 El Capitan because of dependencies on gcc48 (see thread, and I installed gcc49, but not sure how to make use of that particular version. Thank you.

  2. Amitabha … did you install gcc separately or through MacPorts? Typically, it’s something MacPorts installs early on as one of the things on which everything depends. I haven’t seen this particular error.

    Now, to be honest, while I used to update Mac OS X to the latest version, now that I rely on MacPorts, I tend to give it a few months for all the wrinkles to get worked out. So, quick question, MacPorts still encourages you, I think, to reset everything when you update your version of the Mac OS. Did you do that?

    I don’t normally look forward to re-building my MacPorts setup, but now that I’ve made the switch to Python 3.4, I’m kinda looking forward to getting rid of all the Python 2.7 stuff. (But that’s only if I opt for a clean install, and I’m not sure how likely that is, now that I think about everything I would have to re-install.)

    So, short version: check to make sure that your base MacPorts installation is good. If you’ve recently updated Mac OS without re-installing MacPorts that could be a problem. Run selfupdate and upgrade outdated and then try re-installing R.

    Let me know what helps, if you get the chance. (Or if none of this helps.)

Leave a Reply