cargo command not found
Introduction
When you run more command in linux terminal / console, you get the following error message
cargo: command not found
or when using sudo you get the following error message
sudo: cargo: command not found
Solutions to cargo: command not found
How To Fix cargo: command not found in Ubuntu / Debian / Kali Linux / Raspbian
In Ubuntu cargo is provided by cargo package.
cargo is:
Cargo is a tool that allows Rust projects to declare their various dependencies, and ensure that you’ll always get a repeatable build.
To accomplish this goal, Cargo does four things:
- Introduces two metadata files with various bits of project information.
- Fetches and builds your project’s dependencies.
- Invokes rustc or another build tool with the correct parameters to build your project.
- Introduces conventions, making working with Rust projects easier.
Cargo downloads your Rust project’s dependencies and compiles your project.
To fix this problem, we can install more using the command below.
sudo apt-get -y install cargo
This command might take some time to finish depending on your machine internet connection.
You can also use apt command to install cargo.
sudo apt -y install cargo
Or if you have aptitude installed you can use the following command.
sudo aptitude install cargo
Summary
In this tutorial we learn how to fix cargo command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.