rig add
Download and install an R version, from the official sources. It keeps the already installed R versions, except on macOS in admin mode, where patch versions of the same minor overwrite each other.
On macOS and Windows rig uses the R builds at https://cran.r-project.org. On Linux rig uses the Posit R builds from https://github.com/rstudio/r-builds.
On Linux, in user mode rig always installs a portable build, selected for your C library (glibc or musl). In admin mode rig installs a distro-specific build by default, but you can install a portable build instead with --platform linux-portable (or a specific portable platform, e.g. --platform linux-manylinux-2.34). If there is no distro-specific build for your platform, rig falls back to a portable build automatically. Admin-mode portable builds are installed into /opt/R/<version>, just like distro-specific builds.
The desired R version can be specified in various ways:
rig add develadds the latest available development version,rig add nextis the next version (patched, alpha, beta, rc, etc.),rig add releaseadds the latest release.rig add x.y.zadds a specific version.rig add x.yadds the latest release within thex.yminor branch.rig add oldrel/nadds the latest release within thenth previous minor branch (oldrelis the same asoldrel/1).rig add <url>uses a build from<url>.
In user mode rig installs R into your home directory and never needs sudo. In admin mode you usually need to run this command with sudo: sudo rig add ..., otherwise rig will need to ask for your password.
In admin mode on macOS rig cannot add multiple R versions from the same minor branch. E.g. it is not possible to have R 4.6.0 and R 4.6.1 installed at the same time. Adding one of them will automatically remove the other. In user mode there is no such restriction.
You can use rig add to install Rtools:
rig add rtoolswill install all Rtools versions that are needed for the currently installed R versions. You can also request a specific Rtools version, e.g. rig add rtools45.
In user mode rig installs R and Rtools into your user profile, without administrator rights. In admin mode you need an administrator account to run this command.
Usage
rig add [OPTIONS] [str]
Arguments
[str]- R version to install [default: release]
Options
--admin- Run in admin mode (overrides RIG_MODE and config)
-a, --arch <arch>- Select architecture: arm64 or x86_64
-h, --help- Print help (see a summary with ‘-h’)
--pak-version <pak-version>-
pak version to install.
[default: stable]
[possible values: stable, rc, devel] --platform <platform>Linux only-
Install the build for this platform, instead of auto-detecting it. Use
linux-portableto install a portable (glibc/musl) build. --user- Run in user mode (overrides RIG_MODE and config)
--with-desktop-iconWindows only- Install a desktop icon.
--with-repos=<with-repos>-
Repositories to enable, in addition to the ones enabled by default. If
--without-reposis also specified (without a value), then only these repositories will be enabled. --without-cran-mirror-
Do not set the cloud CRAN mirror. Deprecated in favor of
--without-repos=cran. --without-p3m-
Do not set up P3M. This is the default on macOS. Deprecated in favor of
--without-repos=p3m. [alias:--without-rspm] --without-pak- Do not install pak.
--without-repos[=<without-repos>]-
Do not set up package repositories. Alternatively, specify which ones to skip, a comma-separated list. If
--with-reposis also specified, then only the repositories in that argument will be enabled. --without-sysreqsLinux only- Do not set up system requirements installation.
--without-translationsWindows only- Do not install translations.
Examples
# Add the latest development snapshot
rig add devel# Add the latest release
rig add release# Install specific version
rig add 4.6.1# Install latest version within a minor branch
rig add 4.6# Install arm64 build of R (default on arm64 machines)
rig add -a arm64 release# Install x86_64 build of R (default on x86_64 machines)
rig add -a x86_64 release# Install all needed Rtools versions (Windows only)
rig add rtools