Cargo Install
Install xrat with Cargo. Use this path if you already have a Rust toolchain
and want cargo-managed installs without the install script.
For release binaries, see Installation Script or Manual Binary Install. To build from a checkout, see Build From Source.
Requirements
- Rust toolchain via rustup (
cargoinPATH) - Xray is required for runtime use;
xrat setupcan install it and optional sing-box/V2Ray cores as verified user-local tools
Install with cargo-binstall (recommended)
cargo-binstall downloads the matching prebuilt release binary instead of compiling from source, so it’s as fast as the install script but stays inside your Cargo toolchain:
cargo binstall xrat
Install cargo-binstall itself first if you don’t have it:
cargo install cargo-binstall
Install from crates.io (builds from source)
cargo install xrat
Cargo places the binary in ~/.cargo/bin/xrat. Ensure that directory is in
PATH:
export PATH="$HOME/.cargo/bin:$PATH"
Add that line to your shell startup file if xrat --version cannot find it.
Run Setup
cargo install/cargo binstall only place the binary. Run
xrat setup to complete setup — it checks dependencies,
runs xrat init, offers to install the background daemon, and installs shell
completions, man pages, an xratui shortcut, and (on Linux/XDG) a desktop
launcher with icons:
xrat setup
Setup is idempotent and re-runnable. Use -y to accept defaults
non-interactively, --no-daemon / --no-desktop to skip steps, or
xrat setup --check to report what is and isn’t configured without changing
anything.
Then follow the Quickstart.
Update and Uninstall
cargo binstall xrat # reinstall/upgrade via prebuilt binary
cargo install xrat # reinstall/upgrade by building from source
cargo uninstall xrat # remove the Cargo-installed binary
xrat upgrade self-upgrades a release-archive install; for a Cargo-installed
binary, prefer cargo binstall xrat or cargo install xrat to update.