RStudio does not start Error 60

Anyone can help with this? I have looked at previous answers but can't seem to be able to find something that works. I installed Rstudio via Anaconda Navigator, and in /anaconda3/bin the R file has

R_HOME_DIR=/Library/Frameworks/R.framework/Resources

but Rstudio did not launch. I had to install the R GUI app later, which does work perfectly, however now RStudio seems to find R there, which is strange because as far as I understand it should look in the anaconda bin directory. I attach below the error I get in the .rstudio-desktp log. Thanks in advance.

09 Oct 2019 14:23:05 [rdesktop] ERROR Unable to find R_HOME_DIR in /Applications/R.app/Contents/MacOS/R; LOGGED FROM: bool rstudio::core::r_util::<anonymous namespace>::getRHomeAndLibPath(const rstudio::core::FilePath &, const config_utils::Variables &, std::string *, std::string *, std::string *) /Users/ray/rsbuild/work/src/cpp/core/r_util/REnvironmentPosix.cpp:154
09 Oct 2019 14:23:16 [rdesktop] ERROR system error 60 (Operation timed out); OCCURRED AT: rstudio::core::Error rstudio::core::waitWithTimeout(const boost::function<WaitResult ()> &, int, int, int) /Users/ray/rsbuild/work/src/cpp/core/WaitUtils.cpp:63; LOGGED FROM: -[AppDelegate applicationDidFinishLaunching:] /Users/ray/rsbuild/work/src/cpp/desktop-mac/AppDelegate.mm:376

What is the output of:

which R | xargs readlink

on your machine? By default, RStudio uses whichever version of R it finds on the PATH; it's likely that RStudio is discovering that version instead of the one you want.

A workaround is to set the environment variable:

RSTUDIO_WHICH_R=/path/to/R

to force RStudio to look for a particular R installation.

$ which R | xargs readlink

now produces:

/Library/Frameworks/R.framework/Resources/bin/R

which is the console R. But in fact I have exactly the same result with both variants of R set to RSTUDIO_WHICH_R, and R_HOME: I get the little window with an yellow exclamation mark and nothing else. In both cases my rdesktop.log now only shows ERROR 60:

12 Oct 2019 19:28:57 [rdesktop] ERROR system error 60 (Operation timed out); OCCURRED AT: rstudio::core::Error rstudio::core::waitWithTimeout(const boost::function<WaitResult ()> &, int, int, int) /Users/ray/rsbuild/work/src/cpp/core/WaitUtils.cpp:63; LOGGED FROM: -[AppDelegate applicationDidFinishLaunching:] /Users/ray/rsbuild/work/src/cpp/desktop-mac/AppDelegate.mm:376

I am also puzzled by this /Users/ray/... in the above error message, which looks like some outside process. Is this a message that has been created when RStudio was built? Because it does look like something connecting into my machine.

Thanks!