R and GNU tools via Homebrew

[This article was first published on Pachá (Batteries Included), and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Original posted on 2017-01-08
Updated posted on 2017-07-12

Introduction

A few months ago I needed to use stock Python. One way to achieve that, and not to use OS X provided version, is to install it using Homebrew. Why I needed that? Python packages installed via pip were not recognised.

In recent weeks I needed to compile R packages using linear algebra libraries. Here I’m also explaining how to set up openblas and lapack to use them with R.

Why should you do this?

With a single brew upgrade you can save yourself a headache and valuable time when you need newer software versions.

What do you need to do this?

You’ll need Homebrew and XCode installed. How to do that? check these links

Its possible to install just Command Line Tools for XCode from Apple Developers instead of full XCode.

Hands to the work

To install R, GNU tools and updated tools via Homebrew run this script:

This is based on Xudev’s script and here I’m adding linear algebra libraries, adding R installation, updating deprecated parameters such as tap and doing post-install additional configurations.

Post-installation

The script does many post-installation steps but be sure to check brew messages after install.

For example, when I install make I have this output:

==> Pouring make-4.2.1_1.el_capitan.bottle.tar.gz
==> Using the sandbox
==> Caveats
All commands have been installed with the prefix 'g'.
If you do not want the prefix, install using the "with-default-names" option.

If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:

    PATH="/usr/local/opt/make/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:

    MANPATH="/usr/local/opt/make/libexec/gnuman:$MANPATH"
==> Summary
?  /usr/local/Cellar/make/4.2.1_1: 15 files, 960.0KB

What is suggested above is in the script. But, if your brew install is totally fresh probably a few more utilities need to edit user PATH and the command line will return a proper message.

Consider that gdb won’t work out-of-the-box. Don’t forget to follow this post-installation tutorial by Steven Burns to get gdb working.

Finally, to enable rJava probably you’ll need to try and verify if you need another command to enable it. The script has three different possibilities depending on your Java version.

To leave a comment for the author, please follow the link and comment on their blog: Pachá (Batteries Included).

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)