Skip to content

Instantly share code, notes, and snippets.

@arraytools
Last active March 26, 2025 16:51
Show Gist options
  • Select an option

  • Save arraytools/83c8aade68f44b42557d6f1afbb906a2 to your computer and use it in GitHub Desktop.

Select an option

Save arraytools/83c8aade68f44b42557d6f1afbb906a2 to your computer and use it in GitHub Desktop.
Install multiple versions of R and launch RStudio with different versions of R. Here I assume I'm working on a Debian desktop (Linux distro affects how R is installed and the binary version of RStudio.
# Ubuntu noble
wget https://cran.r-project.org/src/base/R-4/R-4.4.3.tar.gz
tar -xzvf R-4.4.3.tar.gz
cd R-4.4.3
sudo apt install -y gfortran libreadline-dev \
# libx11-dev libxt-dev \
libpng-dev libjpeg-dev libcairo2-dev \
xvfb libbz2-dev liblzma-dev libzstd-dev \
libcurl4-openssl-dev libssl-dev libpcre2-dev
./configure --prefix=/opt/R/4.4.3 --enable-R-shlib
make -j 4
sudo make install
/opt/R/4.4.3/bin/R
# References:
# https://cran.r-project.org/bin/linux/debian/
# https://rviews.rstudio.com/2018/03/21/multiple-versions-of-r/
# 2023/12/30
sudo nano /etc/apt/sources.list # deb-src http://deb.debian.org/debian/ unstable main
sudo apt update
sudo apt build-dep r-base
wget https://cran.r-project.org/src/base/R-4/R-4.3.2.tar.gz
tar -xzvf R-4.3.2.tar.gz
cd R-4.3.2
./configure --prefix=/opt/R/$(cat VERSION) --enable-R-shlib --with-blas --with-lapack
make -j2
sudo make install
wget https://cran.r-project.org/src/base/R-4/R-4.2.3.tar.gz
tar -xzvf R-4.2.3.tar.gz
cd R-4.2.3
./configure --prefix=/opt/R/$(cat VERSION) --enable-R-shlib --with-blas --with-lapack
make -j2
sudo make install
# I am on Debian 12, so download Debian 12 version of RStudio
sudo apt install ./Downloads/rstudio-2023.12.0-369-amd64.deb
env RSTUDIO_WHICH_R=/opt/R/4.3.2/bin/R rstudio &
env RSTUDIO_WHICH_R=/opt/R/4.2.3/bin/R rstudio &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment