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