Installation
Prerequisites
ferx requires R >= 4.2, Rust (stable toolchain), and cmake.
| Dependency | Required | Notes |
|---|---|---|
| R >= 4.2 | Yes | Package interface |
| Rust / Cargo | Yes | Compiles the ferx-core backend; the stable toolchain is sufficient |
| cmake | Yes | Used by the Rust build (Linux/macOS; bundled with Rtools45 on Windows) |
The first install compiles the Rust backend. Build time depends heavily on CPU speed: about 15-30 minutes on a fast modern machine, and up to 1-2 hours on an older laptop. Subsequent installs are much faster because Cargo reuses cached artifacts.
Quick install by platform
macOS
cmake is the only non-standard system dependency. A stable Rust toolchain is sufficient.
Step 1 - Install Homebrew (skip if already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Step 2 - Install cmake
brew install cmakeStep 3 - Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shFollow the on-screen instructions to add Rust to your PATH, usually source "$HOME/.cargo/env" or restarting the terminal.
Step 4 - Install ferx from R
RStudio on macOS launches with a restricted PATH that does not include the Homebrew cmake bin directory, even when the shell profile is configured correctly. Add it explicitly before installing:
# Apple Silicon (M1/M2/M3):
Sys.setenv(PATH = paste("/opt/homebrew/opt/cmake/bin", Sys.getenv("PATH"), sep = ":"))
# Intel Mac - use this line instead:
# Sys.setenv(PATH = paste("/usr/local/opt/cmake/bin", Sys.getenv("PATH"), sep = ":"))
pak::pak("FeRx-NLME/ferx-r")
# or: devtools::install_github("FeRx-NLME/ferx-r")Without the Sys.setenv(PATH = ...) line, the Rust build fails with a cmake not found error when launched from RStudio.
Windows
Native Windows installs are supported.
Step 1 - Install Rtools45
Rtools45 ships cmake and the MinGW gcc that R uses to link the package, so no separate cmake install is needed.
Step 2 - Install rustup with the GNU-ABI toolchain
Download from https://www.rust-lang.org/tools/install, then in PowerShell:
rustup toolchain install stable-x86_64-pc-windows-gnuYou do not need to rustup default it: the package build pins this toolchain automatically on Windows. The rustup default on Windows is the MSVC ABI, which is not link-compatible with Rtools’ MinGW linker.
Step 3 - Install ferx from R
pak::pak("FeRx-NLME/ferx-r")
# or: devtools::install_github("FeRx-NLME/ferx-r")Linux
Install cmake and Rust via your system package manager plus rustup. RStudio on Linux inherits the system PATH, so no PATH workaround is needed.
# Debian / Ubuntu
sudo apt-get install -y cmake build-essential curl git
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"pak::pak("FeRx-NLME/ferx-r")
# or: devtools::install_github("FeRx-NLME/ferx-r")Verify the installation
library(ferx)
ferx_example() # lists all bundled examples
ex <- ferx_example("warfarin")
fit <- ferx_fit(ex$model, ex$data)
print(fit)print(fit) leads with a STATUS: CONVERGED line and bold section headers. ferx_warnings(fit) shows any warnings grouped by severity with remediation guidance.
Docker / reproducible environments
The ferx-r repo ships a Dockerfile for reproducible local or CI environments:
git clone https://github.com/FeRx-NLME/ferx-r
cd ferx-r
# Build
docker build -t ferx:latest .
# Run RStudio Server
docker run --rm -p 8787:8787 -e PASSWORD=ferx ferx:latest
# -> open http://localhost:8787 user: rstudio password: ferxFor a minimal CI image:
FROM rocker/r-ver:4.4.0
RUN Rscript -e "pak::pak('FeRx-NLME/ferx-r')"