rustfmt command not found
Introduction
When you run more command in linux terminal / console, you get the following error message
rustfmt: command not found
or when using sudo you get the following error message
sudo: rustfmt: command not found
Solutions to rustfmt: command not found
How To Fix rustfmt: command not found in Ubuntu / Debian / Kali Linux / Raspbian
In Ubuntu rustfmt is provided by rustfmt package.
rustfmt is:
Rust is a curly-brace, block-structured expression language. It visually resembles the C language family, but differs significantly in syntactic and semantic details. Its design is oriented toward concerns of “programming in the large”, that is, of creating and maintaining boundaries - both abstract and operational - that preserve large-system integrity, availability and concurrency.
It supports a mixture of imperative procedural, concurrent actor, object-oriented and pure functional styles. Rust also supports generic programming and meta-programming, in both static and dynamic styles.
This package contains ‘rustfmt’, a tool for formatting Rust code according to style guidelines, as well as ‘cargo-fmt’, a helper enabling running rustfmt directly with ‘cargo fmt’.
To fix this problem, we can install more using the command below.
sudo apt-get -y install rustfmt
This command might take some time to finish depending on your machine internet connection.
You can also use apt command to install rustfmt.
sudo apt -y install rustfmt
Or if you have aptitude installed you can use the following command.
sudo aptitude install rustfmt
Summary
In this tutorial we learn how to fix rustfmt command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.