rig add
Alias: rig install
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 portable builds are newer and less tested than the distro-specific ones, so please report problems at https://github.com/r-lib/rig/issues.
The portable builds bundle the fontconfig library, but no fontconfig configuration and no fonts, so on a minimal system R cannot render text at all. After installing a portable build rig therefore writes a fonts.conf and downloads a small set of fallback fonts, next to the R installations (see rig system dirs --fonts), and points R at them. The configuration also lists the standard system font directories, so your own fonts keep working. Use --without-fonts to skip the font download and use only the fonts that are already installed on the system. Setting FONTCONFIG_FILE yourself overrides all of this. Set RIG_FONTS_URL (and optionally RIG_FONTS_SHA256) to download the fonts from a mirror instead.
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>.rig add renv.lock(or a path to one, e.g.rig add path/to/renv.lock) adds the R version recorded in an renv lock file.
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.
If the requested version is already installed, rig add does nothing (other than making sure any implied alias, e.g. release, still points at it) instead of reinstalling it. Use --reinstall to reinstall anyway. R-devel and R-next are rebuilt daily under the same version number, so rig add devel and rig add next reinstall them, unless the installer has not changed (has the same HTTP ETag) since rig last installed it.
With --json, rig add prints a JSON object to the standard output about the R version it installed, or about the already installed version it kept. The fields are the same as in rig list --json (name, default, version, aliases, path, binary), plus new-install, which is true if rig installed R now and false if it kept an existing installation. default tells whether this version is the default one after rig add finished. All other messages go to the standard error.
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. rig add rtools does not support --json, use rig rtools add --json instead.
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’)
--json- JSON output
--no-cache- Do not read or write rig’s cache (overrides RIG_NO_CACHE and config)
--pak-version <pak-version>-
pak version to install.
[default: stable]
[possible values: stable, 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. --reinstall- Reinstall, even if this R version is already installed.
--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-fontsLinux only- Do not download fallback fonts. rig still writes the fontconfig configuration, but R will only see the fonts that are already installed on the system.
--without-p3m-
Do not set up P3M. 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 a version and print information about it as JSON
rig add --json release# Install latest version within a minor branch
rig add 4.6# Install the R version an renv.lock file requires
rig add renv.lock# 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