Skip to main content

Installation

{baler} ships as a native binary. There is no R package to install for the CLI itself, only for the {box} fork it depends on at runtime (see below).

Pre-built binaries

Pre-built binaries for Linux, macOS, and Windows are published on the Releases page.

  1. Linux / macOS:

    curl -sSL https://raw.githubusercontent.com/baler-dev/baler/refs/heads/main/scripts/install.sh | bash
  2. Windows:

    powershell -ExecutionPolicy Bypass -c "irm https://raw.githubusercontent.com/baler-dev/baler/refs/heads/main/scripts/install.ps1 | iex"

Both scripts download the archive for your platform from the latest release, and also the .sha256 file published next to it. The archive is unpacked and installed only when its SHA-256 hash matches that file. On a mismatch, a missing checksum file or a malformed one, nothing is installed, and an existing baler stays as it was.

To pin a specific version, use that version’s installer, which is published with every release and already knows its own tag:

curl -LsSf https://github.com/baler-dev/baler/releases/download/v0.1.0/baler-installer.sh | bash
powershell -ExecutionPolicy Bypass -c "irm https://github.com/baler-dev/baler/releases/download/v0.1.0/baler-installer.ps1 | iex"

On Linux and macOS, setting BALER_VERSION (for example BALER_VERSION=v0.1.0) pins the version when you run the script from main.

Building from source

{baler} is a CLI tool built in Rust, so it requires the stable Rust toolchain (rustc, cargo). Once you managed to add the Rust toolchain, install {baler} from scratch via following command:

cargo install --git https://github.com/baler-dev/baler

The baler binary is built with the network feature of baler-core already on, so --git and --url installs work out of the box. The feature only matters if you use baler-core as a library: without it, those two install paths fail with an explicit “requires the ‘network’ feature” error rather than silently doing nothing.

Verifying the install

baler --version

The {box} fork

box-bale modules are loaded through {box}, but the patches that make box::use() find {baler}’s install location aren’t in upstream {box} yet. Until they land, use the patched fork.

With baler box install

With R installed, one command does the whole job:

baler box install

It picks the file made for your R version and platform from the latest release, checks it against its published SHA-256, and installs it into your R library. That is the first of BALER_R_LIB, R_LIBS_USER and R’s own first library path, the same one baler install --install-deps uses. No compiler is needed, and R CMD INSTALL is not run.

  • A {box} that is already the baler build and already current is left alone, and --force installs it again.
  • An upstream {box} in that library is not replaced unless you pass --force, because installing the fork replaces it. To keep both, point BALER_R_LIB at another library.
  • --tag v0.2.0 takes {box} from that release instead of the latest one. Only the latest release has its {box} files kept up to date.
  • If the release has no build for your R version, the error lists the R versions it does have and prints the command to build the fork from source. It never starts a compile on its own.
  • On Windows, close R sessions that have {box} loaded first, since Windows does not let a loaded library be replaced.
  • Requests to GitHub send GITHUB_TOKEN (or GH_TOKEN) when one is set, which helps on CI where anonymous requests are rate limited.

Check what is installed with:

baler box status

It shows the version, whether it has {baler} support, and the commit it was built from, and it reads files only. baler box status --check also exits with an error unless a {box} with {baler} support is installed, which is handy in CI.

To get both with one command, set BALER_WITH_BOX=1 when you run the install script. A problem with {box} is reported but never fails the {baler} install.

curl -sSL https://raw.githubusercontent.com/baler-dev/baler/refs/heads/main/scripts/install.sh | BALER_WITH_BOX=1 bash
$env:BALER_WITH_BOX = "1"
powershell -ExecutionPolicy Bypass -c "irm https://raw.githubusercontent.com/baler-dev/baler/refs/heads/main/scripts/install.ps1 | iex"

Pre-built, by hand

baler box install uses the files below. To do the same steps yourself, or when baler is not installed on that machine, take them from the release directly. Releases ship the fork already built, for the current and the previous R version. If the build fails, the release goes out without these files, so if you don’t see them, build it yourself. Pick the file for your platform:

Platform The file name ends with
Linux (Intel or AMD) _linux-x86_64.tar.gz
Linux (ARM) _linux-aarch64.tar.gz
macOS (Apple silicon) _macos-aarch64.tgz
macOS (Intel) _macos-x86_64.tgz
Windows _windows-x86_64.zip

The full name is box_<version>_R<major.minor>_<platform>, for example box_1.2.3.261119_R4.5_linux-x86_64.tar.gz. It has to match your R version, so check your R version by running R.version$version.string in R or run R --version and look at the first two numbers (4.5.2 means R4.5).

  1. Download the file and its .sha256 from the releases page.

  2. Check the download. On Linux run sha256sum -c <file>.sha256, on macOS shasum -a 256 -c <file>.sha256, and on Windows compare the output of Get-FileHash <file> with the .sha256 file.

  3. Rename it to box_<version>.<extension>, such as box_1.2.3.261119.tar.gz. R reads the package name and version from the file name, and a longer name makes the install fail on some platforms.

  4. Install it:

    R CMD INSTALL box_1.2.3.261119.tar.gz

The files on the latest release are rebuilt when the fork changes (it is checked every 6 hours), so they follow it. Older releases keep the files they shipped with, and a release that shipped without them stays that way.

Building it yourself

If there is no file for your platform or R version, for example right after a new R release, compile the fork instead.

# install.packages('pak')
# This needs compilation
pak::pak("joshuamarie/box@feature/baler-support")

What’s more?

Next: Get Started walks through initializing, bundling, and installing a module end to end.