I am able to get asdf and RStudio working together very well on my Linux machine, but am having trouble with my macbook. On Linux, after setting an R version with asdf local R <version>, simply running rstudio in the project directory will open a new RStudio instance with the R version specified in .tool-versions.
However, on macOS, RStudio is opened using the open command like so: open -a rstudio. Doing so ignores the .tool-versions file, and instead opens an RStudio instance with the system R version as the back-end. I have tried specifying the RSTUDIO_WHICH_R environmental variable like so:
open -a rstudio --env RSTUDIO_WHICH_R=$HOME/.asdf/shims/R
But then I get the following error: Unable to find R_HOME_DIR in $HOME/.asdf/shims/R
I tried to set the R_HOME_DIR environmental variable to the respective asdf installation:
open -a rstudio --env RSTUDIO_WHICH_R=$HOME/.asdf/shims/R --env R_HOME_DIR=$HOME/.asdf/installs/R/<version>/lib/R
But this returns the same error as above. I am not quite sure why it works without any problems on Linux, but then gives me issues on macOS. I assume it has something to do with differences between the open command used on mac versus simply calling rstudio on Linux.
Curious if anyone has run into this issue/has come across a solution?
I am able to get asdf and RStudio working together very well on my Linux machine, but am having trouble with my macbook. On Linux, after setting an R version with
asdf local R <version>
, simply runningrstudio
in the project directory will open a new RStudio instance with the R version specified in.tool-versions
.However, on macOS, RStudio is opened using the
open
command like so:open -a rstudio
. Doing so ignores the.tool-versions
file, and instead opens an RStudio instance with the system R version as the back-end. I have tried specifying theRSTUDIO_WHICH_R
environmental variable like so:open -a rstudio --env RSTUDIO_WHICH_R=$HOME/.asdf/shims/R
But then I get the following error:
Unable to find R_HOME_DIR in $HOME/.asdf/shims/R
I tried to set the
R_HOME_DIR
environmental variable to the respective asdf installation:open -a rstudio --env RSTUDIO_WHICH_R=$HOME/.asdf/shims/R --env R_HOME_DIR=$HOME/.asdf/installs/R/<version>/lib/R
But this returns the same error as above. I am not quite sure why it works without any problems on Linux, but then gives me issues on macOS. I assume it has something to do with differences between the
open
command used on mac versus simply callingrstudio
on Linux.Curious if anyone has run into this issue/has come across a solution?