rapt

rapt

Last updated: 2026-02-06

R + apt: A Python-free alternative to bspm for r2u binary installs.

What it does

Makes install.packages("dplyr") install r-cran-dplyr via apt instead of compiling from source. Fast binary installs with no Python in the stack.

Architecture

1R session  →  Unix socket  →  raptd (root)  →  apt install r-cran-*

A minimal C daemon (raptd) listens on /run/raptd.sock and executes apt commands on behalf of unprivileged users.

Installation and Usage

Install build dependencies as needed

1sudo apt install debhelper r-base-dev

Clone repo and cd:

1git clone https://github.com/cornball-ai/rapt.git
2cd rapt/pkg

Build .deb and install:

1# Build
2dpkg-buildpackage -us -uc -b
3
4# Install
5sudo apt install ../rapt_0.1.0-1_amd64.deb

The .deb installs everything: daemon, systemd units, R package, and enables rapt system-wide.

After installing the .deb, rapt is enabled automatically. Just use R normally:

1install.packages("dplyr")
2#> Installing via apt: dplyr

With the R package only (no daemon, no systemd)

Clone repo and install:

1git clone https://github.com/cornball-ai/rapt.git
2cd rapt/r-pkg/
3R CMD INSTALL .

Or without cloning:

1remotes::install_github("cornball-ai/rapt", subdir = "r-pkg")

Then in R:

1rapt::enable()
2install.packages("dplyr")  # now goes through apt via sudo

To make it permanent, add to ~/.Rprofile:

1if (requireNamespace("rapt", quietly = TRUE)) rapt::enable()

Passwordless sudo for apt

Without the daemon, rapt falls back to sudo apt. To avoid password prompts, add a sudoers rule limited to R packages:

1# /etc/sudoers.d/rapt
2%users ALL=(root) NOPASSWD: /usr/bin/apt install -y r-cran-*
3%users ALL=(root) NOPASSWD: /usr/bin/apt remove -y r-cran-*
4%users ALL=(root) NOPASSWD: /usr/bin/apt install -y r-bioc-*
5%users ALL=(root) NOPASSWD: /usr/bin/apt remove -y r-bioc-*

Manual control

 1library(rapt)
 2
 3# Check status
 4manager()
 5#> $daemon_available
 6#> [1] TRUE
 7#> $socket_path
 8#> [1] "/run/raptd.sock"
 9#> $enabled
10#> [1] TRUE
11
12# Direct system package management
13install_sys("ggplot2")
14remove_sys("ggplot2")
15
16# List available system packages
17head(available_sys())
18#> [1] "a]4" "abc" "abcrf" "abd" "abess" "abn"
19
20# Disable/enable hook
21disable()
22install.packages("dplyr")  # Now uses CRAN
23enable()
24install.packages("dplyr")  # Back to apt

Configuration

Options (set in ~/.Rprofile or /etc/R/Rprofile.site):

1# Allow sudo fallback when daemon unavailable (default: FALSE in non-interactive)
2options(rapt.sudo = TRUE)
3
4# Custom socket path (default: /run/raptd.sock)
5options(rapt.socket = "/run/raptd.sock")

Requirements

  • Ubuntu with r2u configured
  • R >= 4.0
  • systemd (optional — for the daemon; without it, falls back to sudo/root)

How it compares to bspm

bspmrapt
BackendPython D-Bus → PackageKitC daemon → apt
DependenciesPython, dbus-python, PackageKitlibc
SocketD-Bus system busUnix domain socket
Lines of code~1500~500

License

MIT

Reference

See Function Reference for complete API documentation.

Functions