How can the R location be customized for RStudio

ぃ、小莉子 提交于 2019-12-11 03:39:41

问题


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.


回答1:


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.




回答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.




回答3:


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



来源:https://stackoverflow.com/questions/18128859/how-can-the-r-location-be-customized-for-rstudio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!