0

I installed the previous version of R (4.0.5) and redirected RStudio according to the RStudio Support site here. However, I would now like to go back to the repository version (R 4.1.0), which is on my system at /usr/bin/R. After running export RSTUDIO_WHICH_R=/usr/bin/R to go back, the result of which R still outputs '/usr/local/bin/R' so I cannot open RStudio from the Desktop Applications Menu. When I try, it's looking for an R shared library (/usr/local/lib/R/lib/libR.so) even though I did build with the --enable-R-shlib option. If I open RStudio from the terminal, it opens fine with R 4.1.0

The support page says I need to change ~/.profile to be able to open RStudio from the Application Menu but I don't know how or where to change this. Is someone able to help with this? I would consider myself in the upper-beginner class of Linux user (I'm on Ubuntu 20.04).

I tried removing RStudio and the ~/.local/share/rstudio preferences and reinstalling but still have the same issue.

Thanks in advance, Jeremy

2
  • Thanks @user68186, that's a start. The ~/.profile file currently has only if/then statements (if-then-fi) so do you (or someone else) know how I can write the export RSTUDIO_WHICH_R=/usr/bin/R in an appropriate form?
    – JJGabe
    May 21, 2021 at 21:20
  • Let me write it as an answer.
    – user68186
    May 21, 2021 at 21:41

1 Answer 1

1

Make a backup of your .profile

Open a terminal and use the cp command as follows:

cp ~/.profile ~/.profile.bak

Edit the .profile file

Open the .profile file in a text editor. The last few lines may look like this:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Add a new line at the end of the last line and copy the command:

export RSTUDIO_WHICH_R=/usr/bin/R

Now the end of the file should look something like this:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
export RSTUDIO_WHICH_R=/usr/bin/R

Save the files and close the text file editor.

Log out and log back in so that the changes take effect.

Open RStudio and verify the R version from within RStudio.

If it does not work...

...revert back to the backup version of the .profile using the following command:

cp ~/.profile.bak ~/.profile

If it works...

...you may delete the backup file, or keep it for future reference.

Hope this helps

4
  • That did it, thank you so much! Quick follow up, how can remove the previous version of R that I built from a tarball and is now in /usr/local/bin/R? Should I just have to navigate to the R directory I installed from and run sudo make uninstall? I didn't see any uninstall file in there.
    – JJGabe
    May 21, 2021 at 23:10
  • @JJGabe you are welcome! I don't know off-hand how to uninstall something you installed from source, but I think it must have been asked and answered before. Please search the site.
    – user68186
    May 22, 2021 at 2:55
  • See this question.
    – user68186
    May 22, 2021 at 2:58
  • 1
    That also worked. I'll be sure to use checkinstall from now on, though I don't often build source packages. Thanks, again!
    – JJGabe
    May 24, 2021 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .