R + apt: A Python-free alternative to bspm for r2u binary installs.
Makes install.packages("dplyr") install r-cran-dplyr via apt instead of compiling from source. Fast binary installs with no Python in the stack.
R 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.
Install build dependencies as needed
sudo apt install debhelper r-base-devClone repo and cd:
git clone https://github.com/cornball-ai/rapt.git
cd rapt/pkgBuild .deb and install:
# Build
dpkg-buildpackage -us -uc -b -tc
# Install
sudo apt install ../rapt_0.1.0-1_amd64.debThe .deb installs everything: daemon, systemd units, R package, and enables rapt system-wide via /etc/R/profile.d/rapt.R.
After installing the .deb, rapt is enabled automatically. Just use R normally:
install.packages("dplyr")
#> Installing via apt: dplyrClone repo and install:
git clone https://github.com/cornball-ai/rapt.git
cd rapt/r-pkg/
R CMD INSTALL .Or without cloning:
remotes::install_github("cornball-ai/rapt", subdir = "r-pkg")Then in R:
rapt::enable()
install.packages("dplyr") # now goes through apt via sudoTo make it permanent, add to ~/.Rprofile:
if (requireNamespace("rapt", quietly = TRUE)) rapt::enable()Without the daemon, rapt falls back to sudo apt. To avoid password prompts, add a sudoers rule limited to R packages:
# /etc/sudoers.d/rapt
%users ALL=(root) NOPASSWD: /usr/bin/apt install -y r-cran-*
%users ALL=(root) NOPASSWD: /usr/bin/apt remove -y r-cran-*
%users ALL=(root) NOPASSWD: /usr/bin/apt install -y r-bioc-*
%users ALL=(root) NOPASSWD: /usr/bin/apt remove -y r-bioc-*library(rapt)
# Check status
manager()
#> $daemon_available
#> [1] TRUE
#> $socket_path
#> [1] "/run/raptd.sock"
#> $enabled
#> [1] TRUE
# Direct system package management
install_sys("ggplot2")
remove_sys("ggplot2")
# List available system packages
head(available_sys())
#> [1] "a]4" "abc" "abcrf" "abd" "abess" "abn"
# Disable/enable hook
disable()
install.packages("dplyr") # Now uses CRAN
enable()
install.packages("dplyr") # Back to aptOptions (set in ~/.Rprofile, /etc/R/Rprofile.site, or a drop-in in /etc/R/profile.d/):
# Allow sudo fallback when daemon unavailable (default: FALSE in non-interactive)
options(rapt.sudo = TRUE)
# Custom socket path (default: /run/raptd.sock)
options(rapt.socket = "/run/raptd.sock")- Ubuntu with r2u configured
- R >= 4.0
- systemd (optional — for the daemon; without it, falls back to sudo/root)
| bspm | rapt | |
|---|---|---|
| Backend | Python D-Bus → PackageKit | C daemon → apt |
| Dependencies | Python, dbus-python, PackageKit | libc |
| Socket | D-Bus system bus | Unix domain socket |
| Lines of code | ~1500 | ~500 |
MIT