Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

cargo is the Rust package manager. It is thus used to installed applications written in the Rust language. Many useful system applications have been written in Rust, hence cargo may be a solution to install a tool that your operating system does not provide.

To install cargo on your system search for the rustup package and install it. Then execute rustup and follow the instructions. You may also use the command provided on https://rustup.rs/ to install rustup.

Once installed you should have access to the cargo command. To search for a crate (bat in the following example), use the search sub-command:

bat = "0.26.1"                   # A cat(1) clone with wings.
hgrep = "0.3.9"                  # hgrep is a grep tool with human-friendly search output. This is similar to `-C` option of `gre…
bat-cli = "0.38.0"               # Blockchain Auditor Toolkit (BAT)
tree-sitter-bats = "0.1.0"       # Bats (Bash Automated Testing System) grammar for tree-sitter, extending tree-sitter-bash.
bat-markets-core = "0.3.5"       # Core domain contracts and in-memory state engine for bat-markets
bat-markets-binance = "0.3.5"    # Binance USD-M linear futures adapter for bat-markets
bat-markets-bybit = "0.3.5"      # Bybit linear USDT futures adapter for bat-markets
bat-markets-mexc = "0.3.5"       # MEXC USDT-M linear futures adapter for bat-markets
bat-markets = "0.3.5"            # Futures-first headless Rust exchange engine with honest Binance/Bybit/MEXC linear futures supp…
rscp = "0.2.0"                   # Rust implementation of E3DC RSCP
... and 1169 crates more (use --limit N to see more)
note: to learn more about a package, run `cargo info <name>`

To install a crate, use the install sub-command:

The bat binary will be installed by default in $HOME/.cargo/bin, which is the default destination of all binaries installed from crates:

/usr/local/cargo/bin/bat

Thus we need to make sure that this path is defined inside our PATH environment variable. See PATH env var to learn what is the PATH environment variable and how to add a folder path to it.