# Installation

## The binary

The [latest release](https://github.com/felix-andreas/ry/releases/latest) has binaries for Linux,
macOS and Windows. Each archive holds a single `ry` binary:

| Platform | Release | Archive |
| --- | --- | --- |
| Linux x86_64, glibc 2.35 or newer | latest | `ry-x86_64-unknown-linux-gnu.tar.gz` |
| macOS on Apple silicon | latest | `ry-aarch64-apple-darwin.tar.gz` |
| Windows x86_64 | latest | `ry-x86_64-pc-windows-gnullvm.zip` |

```bash
curl -fsSL https://github.com/felix-andreas/ry/releases/latest/download/ry-x86_64-unknown-linux-gnu.tar.gz | tar xz
sudo mv ry /usr/local/bin/
ry --version
```

On macOS, download `ry-aarch64-apple-darwin.tar.gz` the same way. On Windows, download
`ry-x86_64-pc-windows-gnullvm.zip` in PowerShell, unpack it, and put the folder holding `ry.exe`
on your `PATH`:

```powershell
curl.exe -fsSLO https://github.com/felix-andreas/ry/releases/latest/download/ry-x86_64-pc-windows-gnullvm.zip
Expand-Archive ry-x86_64-pc-windows-gnullvm.zip -DestinationPath ry
.\ry\ry.exe --version
```

To pin a version, replace `latest/download` with `download/<tag>`. Other ways to install:

```bash
cargo +nightly install --git https://github.com/felix-andreas/ry ry-lang   # from source
nix profile install github:felix-andreas/ry                               # Nix and NixOS
```

ry builds on nightly Rust, and `cargo install` does not read the toolchain the repository pins, so
name `+nightly` yourself.

For each release and nightly, the flake's Linux x86_64 package and dev shell come prebuilt from the
binary cache `https://ry.cachix.org` (public key
`ry.cachix.org-1:6OKbqSFUFIsagxwxTo06JWHSEWuEtQp4kgQtR/TuVyY=`). Other commits on main are not
cached (except the dev shells, whose custom GNU R is cached whenever `flake.nix`, `flake.lock` or
`tools/base-r` changes), so name a release tag to download instead of compiling, as in
`nix profile install github:felix-andreas/ry/<tag>`.
The flake names the cache, so Nix offers it when you build (`--accept-flake-config` accepts it
without asking). If you are not a trusted Nix user, Nix ignores that offer, so run `cachix use ry`
or add both values to `nix.conf` instead.

Nightly snapshots for Linux x86_64 are on the [releases page](https://github.com/felix-andreas/ry/releases)
under tags named `nightly.<date>.<time>.<hash>`; only the newest five are kept. They are untested
snapshots for early feedback, so use a numbered release for anything else.

## R

`ry check`, `ry fmt` and the language server never run R. The commands that do (`ry run`, `ry load`,
`ry test`, `ry document`) run on ry's runtime, which carries its own copy of base R 4.6.2 on every
platform, so no GNU R is needed.

`ry R` runs your code on GNU R itself, so it always needs a GNU R installation.
[CLI](/reference/cli.md#how-ry-finds-r) covers `R_HOME`, BLAS and LAPACK, and where ry caches its
runtime.

## Editors

| Editor | Setup |
| --- | --- |
| VS Code | Install the [ry extension](https://marketplace.visualstudio.com/items?itemName=felix-andreas.ry). |
| Positron, VSCodium | Install the `.vsix` for your platform from the [latest release](https://github.com/felix-andreas/ry/releases/latest) with **Extensions: Install from VSIX...** (ry is not on Open VSX). |
| Zed | Install the [R extension](https://zed.dev/extensions/r), then clone this repository and run **zed: install dev extension** on `editors/zed`. It uses the `ry` on your `PATH`, or downloads the latest release. |
| RStudio | Formatting only: under **Tools → Global Options → Code → Formatting**, set **Code formatter** to **External** and the command to `ry fmt`. |
| Any LSP client | Run `ry server` as the language server for R files. |

On Linux, macOS and Windows the extension bundles the `ry` of its release. On other platforms it
bundles no binary and runs the `ry` on your `PATH`. The `ry.path` setting overrides either. The language
server reads the project's `ry.toml`, so the editor and `ry check` report the same findings.
[Editor settings](/reference/configuration.md#editor-settings) lists the extension's options.

**Next:** [adopt ry](/guide.md) on a project, starting with `ry check`.
