Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the ~/.cargo directory so big?

On my Windows 10 machine it's 3.5GG. What is it storing? How can I trim it down?

like image 374
Pablo Tato Ramos Avatar asked Sep 25 '20 12:09

Pablo Tato Ramos


People also ask

Where does Cargo store downloaded crates?

The "Cargo home" functions as a download and source cache. When building a crate, Cargo stores downloaded build dependencies in the Cargo home.

What does Cargo clean do?

DESCRIPTION. Remove artifacts from the target directory that Cargo has generated in the past. With no options, cargo clean will delete the entire target directory.

What is Cargo registry?

Cargo installs crates and fetches dependencies from a "registry". The default registry is crates.io. A registry contains an "index" which contains a searchable list of available crates. A registry may also provide a web API to support publishing new crates directly from Cargo.

What is Cargo in Rust programming?

Cargo is Rust's build system and package manager. Most Rustaceans use this tool to manage their Rust projects because Cargo handles a lot of tasks for you, such as building your code, downloading the libraries your code depends on, and building those libraries. (We call the libraries that your code needs dependencies.)


1 Answers

It is storing all the downloaded crates you have used, their binaries, the index of registries, etc. It is going to take a lot of space and will keep increasing.

You can safely remove .cargo/registry/ (if you remove the entire folder, you will lose installed binaries and your Cargo configuration if you had one). Afterwards, everything you use again will be downloaded and it will start growing back. It is a common way of getting rid of very old dependencies you are not using anymore.

like image 77
Acorn Avatar answered Oct 05 '22 12:10

Acorn