<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/r-and-gnu-tools-via-homebrew-2/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://pachamaltese.github.io/2017-07-12_r_and_gnu_tools_via_homebrew.html"> Pachá (Batteries Included)</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><em>Original posted on 2017-01-08</em><br>
<em>Updated posted on 2017-07-12</em></p>
<h1>Introduction</h1>
<p>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 <code>pip</code> were not recognised.</p>
<p>In recent weeks I needed to compile R packages using linear algebra libraries. Here I’m also explaining how to set up <code>openblas</code> and <code>lapack</code> to use them with R.</p>
<h1>Why should you do this?</h1>
<p>With a single <code>brew upgrade</code> you can save yourself a headache and valuable time when you need newer software versions.</p>
<h1>What do you need to do this?</h1>
<p>You’ll need Homebrew and XCode installed. How to do that? check these links</p>
<ul>
<li><a rel="nofollow" href="http://brew.sh/" target="_blank">Install Homebrew</a></li>
<li><a rel="nofollow" href="https://developer.apple.com/download/" target="_blank">Install XCode</a></li>
</ul>
<p>Its possible to install just Command Line Tools for XCode from <a rel="nofollow" href="https://developer.apple.com/download/more/" target="_blank">Apple Developers</a> instead of full XCode.</p>
<h1>Hands to the work</h1>
<p>To install R, GNU tools and updated tools via Homebrew run <a rel="nofollow" href="https://gist.github.com/pachamaltese/a789eb3bc96f33b47e5a1499481c0f4b" target="_blank">this script</a>:</p>
<p></p>
<p>This is based on <a rel="nofollow" href="https://gist.github.com/xuhdev/8b1b16fb802f6870729038ce3789568f" target="_blank">Xudev’s script</a> and here I’m adding linear algebra libraries, adding R installation, updating deprecated parameters such as <code>tap</code> and doing post-install additional configurations.</p>
<h1>Post-installation</h1>
<p>The script does many post-installation steps but be sure to check <code>brew</code> messages after install.</p>
<p>For example, when I install <code>make</code> I have this output:</p>
<div>
<pre><span></span><span>==> Pouring make-4.2.1_1.el_capitan.bottle.tar.gz</span>
<span>==> Using the sandbox</span>
<span>==> Caveats</span>
<span>All commands have been installed with the prefix 'g'.</span>
<span>If you do not want the prefix, install using the &quot;with-default-names&quot; option.</span>

<span>If you need to use these commands with their normal names, you</span>
<span>can add a &quot;gnubin&quot; directory to your PATH from your bashrc like:</span>

<span> PATH=&quot;/usr/local/opt/make/libexec/gnubin:</span><span>$</span><span>PATH</span><span>&quot;</span>

<span>Additionally, you can access their man pages with normal names if you add</span>
<span>the &quot;gnuman&quot; directory to your MANPATH from your bashrc as well:</span>

<span> MANPATH=&quot;/usr/local/opt/make/libexec/gnuman:</span><span>$</span><span>MANPATH</span><span>&quot;</span>
<span>==> Summary</span>
<span>🍺 /usr/local/Cellar/make/4.2.1_1: 15 files, 960.0KB</span>
</pre>
</div>
<p>What is suggested above is in the script. But, if your <code>brew</code> install is totally fresh probably a few more utilities need to edit user <code>PATH</code> and the command line will return a proper message.</p>
<p><code>Consider that gdb</code> won’t work out-of-the-box. Don’t forget to follow <a rel="nofollow" href="https://medium.com/@royalstream/how-to-install-and-codesign-gdb-on-os-x-el-capitan-aab3d1172e95#.jbzcfeegv" target="_blank">this post-installation tutorial</a> by Steven Burns to get <code>gdb</code> working.</p>
<p>Finally, to enable <code>rJava</code> 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. </p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://pachamaltese.github.io/2017-07-12_r_and_gnu_tools_via_homebrew.html"> Pachá (Batteries Included)</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/mRrMwciZIKg" height="1"></a></div>