rig: R Installation Manager
repository·main·Indexed 21 days ago
https://github.com/r-lib/rigrig is an R Installation Manager for macOS, Windows, and Linux designed to simplify installing, removing, and managing multiple R versions. It supports symbolic names (e.g., devel, release), provides quick terminal links to specific versions, and manages Rtools on Windows. Key features include a macOS menu bar app for interactive version selection, shell auto-complete for zsh and bash, and a versioned user package library approach to ensure clean environments and persistent packages across R installations.
What's inside rig
- rig is an R installation manager for macOS, Windows, and Linux. It allows you to install, manage, and configure multiple versions of R on a single system, ensuring they work together correctly.
Overview of rig features
mainrig is an R Installation Manager that allows you to install, remove, and configure multiple R versions across macOS, Windows, and Linux.
Key capabilities include:
- Version Management: Install multiple R versions and select a default version for the terminal and RStudio.
- Symbolic Names: Install versions using names like
devel,next,release, oroldrel. - Quick Links: Run specific versions directly via the terminal using links like
R-4.1orR-4.1.2(automatically added to your PATH). - Platform Specifics:
- macOS: Includes a menu bar app for interactive version selection and supports switching between x86_64 and arm64 builds.
- Windows: Automatically installs and sets up appropriate Rtools versions.
- Environment Configuration: Sets up default CRAN/PPM mirrors, creates user-level package libraries, and installs
pakfor automatic system requirement installation. - Developer Tools: Provides shell auto-complete for
zshandbashon macOS/Linux and supports JSON output for scripting.
Docker container features
mainAll
rigDocker containers include the following features:- Pre-installed
rig: You can userigcommands to add or remove R versions inside the container. - Pre-installed
pak: Thehttps://github.com/r-lib/pakpackage is installed for all R versions. - Automatic dependency management: System dependencies are automatically installed via
pak. - Binary package support: Linux binary packages are automatically installed from the Posit Public Package Manager on supported distributions (Ubuntu, Debian, and OpenSUSE).
- Architecture support: Available on
x86_64andaarch64.
- Pre-installed
Understand rig's user package library approach
mainWhy rig uses a user package library
riginstalls non-base packages into a versioned user package library rather than the system library. This provides several benefits:- Permissions: Avoids issues on systems (like Windows and Linux) where the system library is not writeable by regular users.
- Clean Environments: Ensures tools like
R CMD checkorrevdepcheckrun in a clean environment containing only base packages. - Persistence: You can delete and reinstall an R installation (e.g., using
rig rm) without losing your installed R packages.
macOS System Library Permissions
On macOS,
rigchanges the permissions of the system library to prevent users from accidentally installing packages into the system library instead of the user library.Override rig repository settings in R
mainBy default,rigsets specific CRAN mirrors and P3M settings. To ignore these settings and use your own repository configuration, set thereposoption in your.Rprofilefile.Permissions for `rig system make-links`
mainThe permissions required to run
rig system make-linksdepend on the mode in whichrigis operating:- User mode: No administrator rights are required. Links are created in the user's local binary directory (e.g.,
~/.local/bin). - Admin mode: You must have an administrator account. On Unix-like systems, you may need to use
sudo. If you do not usesudo,rigwill prompt you for your password.
- User mode: No administrator rights are required. Links are created in the user's local binary directory (e.g.,
Compare rig and RSwitch
mainWhilerigandRSwitchhave overlapping functionality, they are distinct tools. They can be used together: changing the default R version inRSwitchwill also change it inrig, and vice versa. You can use therigCLI alongside theRSwitchGUI application simultaneously.Install rig on Windows
mainInstallation methods for Windows vary based on your permissions and preferred package manager.
User install (No administrator rights)
Use the PowerShell install script to install into
%USERPROFILE%\.local. This adds%USERPROFILE%\.local\binto your userPATH.irm https://r-lib.github.io/rig/install.ps1 | iexAfter installation, open a new terminal, switch to user mode, and install R:
rig system user-mode rig add releaseSystem install
Download the latest release from GitHub releases and run the installer. You may need to restart your terminal for
rigto be added to yourPATH.Package Managers
- Scoop:
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git scoop install rig - Chocolatey:
choco install rig - WinGet:
winget install posit.rig
- Scoop:
Remove OpenMP flags for older R versions on macOS
mainIf you are installing R versions 3.6.x or earlier on macOS, you may need to remove the
-fopenmpflags from the R configuration to ensure compatibility with Apple's default compilers (instead of CRAN's custom compilers).Note: If you use
rig addto install R,rigautomatically runs this command for you after installation. You only need to run this manually if you are managing an existing R installation that is failing due to OpenMP flags.This command is only applicable in system mode (admin mode). It does nothing on Windows, Linux, or when running in user mode.
sudo rig system no-openmpConfigure shell auto-complete for rig
mainThe rig installers include completion files for
zshandbashon macOS and Linux.- zsh: Completions work automatically out of the box.
- bash: You must install the
bash-completionpackage (via Homebrew or your Linux distribution) and ensure it is loaded in your.bashrc.
Install rig on Linux
mainrigcan be installed on Linux via DEB/RPM packages or tarballs.Ubuntu and Debian (DEB package)
Add the
rigrepository and install ther-rigpackage:`which sudo` curl -L https://rig.r-pkg.org/deb/rig.gpg -o /etc/apt/trusted.gpg.d/rig.gpg `which sudo` sh -c 'echo "deb http://rig.r-pkg.org/deb rig main" > /etc/apt/sources.list.d/rig.list `which sudo` apt update `which sudo` apt install r-rigRHEL, Fedora, Rocky Linux, Almalinux (RPM package)
`which sudo` yum install -y https://github.com/r-lib/rig/releases/download/latest/r-rig-latest-1.$(arch).rpmOpenSUSE and SLES (RPM package)
`which sudo` zypper install -y --allow-unsigned-rpm https://github.com/r-lib/rig/releases/download/latest/r-rig-latest-1.$(arch).rpmAny Linux distribution (tarball)
Uncompress the tarball to
/usr/local:curl -Ls https://github.com/r-lib/rig/releases/download/latest/rig-linux-$(arch)-latest.tar.gz | `which sudo` tar xz -C /usr/localManage R projects with rig proj
mainThe
rig projcommand set allows you to manage R projects by resolving dependencies declared in a package manifest (typically aDESCRIPTIONfile).rigresolves these dependencies against configured repositories and can install them into a project-specific library.Note: This feature is currently experimental and its interface may change in future versions.