Migrating to user mode

If you already have an admin-mode setup, one command moves it into your home directory:

rig system user-mode

It does four things:

  1. Sets the rig mode configuration to user.
  2. Reinstalls your admin-mode R versions in user mode, and restores the previous default version and your version aliases. Versions already installed in user mode are not reinstalled.
  3. Removes the system-wide admin-mode R installations.
  4. Removes the system-wide quick links.

Run it as your normal user, not under sudo. Steps 3 and 4 touch files outside your home directory, so rig asks your password for those, and only for those. Three flags control how much it does:

With both --keep-* flags nothing outside your home directory is touched, so the whole migration needs no admin privileges at all.

If you do not have an admin-mode setup yet, start with Getting started in user mode instead. See Admin mode vs user mode for what changes when you switch.

Warning

There is no need to migrate a working admin-mode setup. Admin mode is still rig’s default and the better tested mode, so only switch if you actually want R inside your home directory, e.g. because you are losing administrator rights on the machine. On Linux, be aware that user mode swaps your distro-specific R build and R packages for portable (manylinux or musl) builds and manylinux packages, which are newer and less tested. If it does not work out, you can go back to admin mode.

rig system user-mode

The cleanup step needs your password. It removes the R versions from /Library/Frameworks/R.framework, tells the system to forget the installer receipts (pkgutil --forget), and removes the /usr/local/bin links, but only those that actually point into the R framework, so links you made yourself are left alone.

The menu bar app is installed separately from the R versions, so it is not affected and keeps working with your user-mode installations.

Then verify, in a new terminal:

rig system dirs   # Mode user, R root under your home directory
rig list          # your versions, with the default and aliases restored
which R           # ~/.local/bin/R, not /usr/local/bin/R
rig system user-mode

The cleanup step triggers a UAC prompt. It removes the R installations from C:\Program Files\R, the quick links in C:\Program Files\R\bin, and the matching registry entries.

On Windows the migration handles Rtools as well: your admin-mode Rtools installations are reinstalled under your user profile and the system-wide ones removed. --no-reinstall skips that too.

Then verify, in a new terminal:

rig system dirs   # Mode user, R root under your user profile
rig list          # your versions, with the default and aliases restored
rig rtools list   # your Rtools installations
Get-Command R     # in .local\bin, not in C:\Program Files\R\bin
rig system user-mode

Since user mode needs a portable R build, rig checks first that one exists for your machine.

The cleanup step needs your password. It removes your distribution’s R packages, the /opt/R/<version> directories, and the /usr/local/bin links, but only those that actually point into /opt/R, so links you made yourself are left alone.

Then verify, in a new terminal:

rig system dirs   # Mode user, R root under your home directory
rig list          # your versions, with the default and aliases restored
which R           # ~/.local/bin/R, not /usr/local/bin/R

Package libraries

If you use the default rig setup, then your package libraries live in your home directory and they are shared between admin and user mode R installations. Nothing needs to be done for them.

Going back to admin mode

Set the mode back and reinstall the versions you want:

rig config set mode=admin
rig add release

The user-mode installations under your home directory stay where they are; remove them with rig rm first if you want them gone.

Where to next