2

I previously used homebrew to install R and the package installer for RStudio. Recently I started using Boxen, which takes over homebrew. I had to re-install R from source using homebrew, and it now exists in my Boxen Cellar location. Now RStudio no longer launches, saying "Unable to locate R binary by scanning standard locations". I tried reinstalling RStudio (I needed to upgrade anyway) but that didn't help. It doesn't even open for long enough to let you specify a custom location.

Alex Benke
  • 153
  • 1
  • 8

3 Answers3

5

OK I figured it out finally. Discovered from this post that you can set RSTUDIO_WHICH_R to your custom location. On Mountain Lion, this is most easily done with:

For OS X Mountain Lion 10.8:

echo setenv RSTUDIO_WHICH_R [your custom bin path]/R | launchctl

Another option is to set a softlink from /usr/local/bin to the custom R path, but the above seems like a better solution.


Edit: For newer macOS versions:

launchctl setenv RSTUDIO_WHICH_R [your custom bin path]/R

But after a restart launchctl has forgotten the environment variable again.
Therefore a LaunchAgent-.plist for launchctl must be created. Instructions could be found here.

Community
  • 1
  • 1
Alex Benke
  • 153
  • 1
  • 8
2

I ended up deleting the alias file "R" from /usr/bin/ In this way, I don't have to set the RStudio environment variable every time. From http://www.rstudio.com/ide/docs/advanced/versions_of_r

Rstudio looks first in /usr/bin/R and then on /usr/local/bin/R, where I have the new version of R installed.

BolzanoW
  • 665
  • 1
  • 6
  • 12
1

This worked for me: 1. First install R 3.2.0 binary for Mac OS X 10.9 (Mavericks) and higher at http://cran.r-project.org/bin/macosx/ 2. Then run R 3. Then run RStudio

Mariska
  • 11
  • 1