简体   繁体   中英

How can the R location be customized for RStudio

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.

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.

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.

这对我有用:1。首先在http://cran.r-project.org/bin/macosx/上安装适用于Mac OS X 10.9(Mavericks)及更高版本的R 3.2.0二进制文件。然后运行R 3.然后运行RStudio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM