Usage examples for rcli
See also rcli -h
Usage: rcli [-h] [-v] [subcommand] <R version> [--arch ARCHITECTURE] [--force]
Available commands:
install Install an R version
switch Switch between installed R versions
list/ls List installed R versions or user libraries (r_versions | user_libs)
remove Remove an installed R version

Install the current development version of R

rcli install devel

Install a specific patch release

rcli install 4.1.1

Install the x86_64 version on a macOS (arm64) system:

rcli install 4.1.0 --arch x86_64

Force the reinstallation of a specific R version

rcli install 4.0.5 --force

List all current installed R version

rcli ls

Switch to an x86_64 R version on macOS which is installed besides the arm version

rcli switch 4.1.1 --arch x86_64

Migrate packages between different R minor versions

Once a year a new R minor version is released which requires the reinstallation of packages as the library path changes.
While there is no dedicated subcommand in rcli available (yet) to help with this task, here's a code snippet to do this "manually". Note that this snippets references library paths from a macOS arm64 machine. If you use a different one, you need to adjust the library paths accordingly!
Also the following assumes that you have already installed the new R version and use it as your active one.
rcli install rel # assuming 'rel' is R 4.2.0
lib_loc <- "~/Library/R/arm64/4.1/library/"
to_install <- unname(installed.packages(lib.loc = lib_loc)[, "Package"])
Note: This will only successfully reinstall packages available on CRAN. GitHub-only packages and local packages will fail.