Skip to content

Working with the Sandbox

Introduced in rv v0.23.0

Four things you are likely to want to do with the system library sandbox. Apart from rv init --sandbox on a brand new project, they are all edits to rproject.toml: no rv command flips the field on an existing project.

Add the field to rproject.toml, above the [project] header since it is a top level field:

rproject.toml
sandbox = true
[project]
name = "my-analysis"
r_version = "4.5"
repositories = [
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/latest" },
]
dependencies = [
"dplyr",
]

Then run rv activate and restart your R session. The sandbox is applied by the activate script at startup, so a session that is already running keeps the .libPaths() it started with. rv sync and rv run do not need a restart.

You can run either rv init --sandbox or set RV_USE_SANDBOX instead of editing each project.

This is the default. However, if you have RV_USE_SANDBOX set, you will need to opt-out explicitly in rproject.toml by adding sandbox = false.

rproject.toml
sandbox = false
[project]
name = "needs-the-system-library"
r_version = "4.5"
repositories = [
{ alias = "PPM", url = "https://packagemanager.posit.co/cran/latest" },
]
dependencies = []

Remove sandbox = true (or set it to false) and restart your R session.