Prerequisites

  • Rust (latest stable)
  • On macOS: Xcode command line tools (xcode-select --install)
  • Optional: pkg-config and system libraries for native R packages

Building

git clone https://github.com/CGMossa/miniR.git
cd miniR
cargo build --release

Build Profiles

ProfileCommandBuild TimeUse Case
minimalcargo build --no-default-features -F minimal~3sParser work, WASM
fastcargo build --no-default-features -F fast~5sQuick iteration
defaultcargo build~8.5sEveryday development
fullcargo build -F full~15sCI, release builds

Running

# Execute an expression
./target/release/r -e 'print(1:10)'

# Run a script
./target/release/r script.R

# Interactive REPL
./target/release/r

Loading CRAN Packages

Point R_LIBS at a directory containing installed R packages:

# Set the library path
export R_LIBS=/path/to/R/library

# Load a package
./target/release/r -e 'library(dplyr); glimpse(mtcars)'

miniR currently loads 131/260 packages in the checked-in compatibility corpus, including the tidyverse core (rlang, dplyr, tibble, purrr, vctrs, forcats).

System Libraries for Native Packages

Some CRAN packages with C/C++ code need system libraries. miniR uses pkg-config to find them:

# macOS (Homebrew)
brew install openssl libxml2 libuv libsass

# The packages that benefit:
# openssl → httr, covr
# libxml2 → xml2
# libuv → fs → htmlwidgets, rmarkdown, bslib
# libsass → sass → bslib, rmarkdown

WASM-Oriented Builds

If you are experimenting with a smaller embedded target rather than the full host runtime, start with:

cargo build --target wasm32-unknown-unknown --no-default-features -F minimal

That is the intended profile shape for WASM work, but builtin auto-registration is still the main blocker to a fully working wasm32 build today. The dedicated WASM Support page explains the gap.