How to clear the Cargo cache


When I run cargo build, various libs get stored within the folder /usr/local/lib/rustlib/.

What is the correct way to clear these libs? I could rm these files manually, but would that be the right thing to do? I noticed that /usr/local/lib/rustlib/manifest is a file containing a list of the fill file paths of all the libs, and hence might be breaking something if I remove these files manually.

Best Solution

I believe that manifest file is just for the built-in libraries, i.e. those distributed with rustc. cargo itself stores things in ~/.cargo (for the moment), if you do wish to just remove all the libraries then deleting that directory won't break anything.

If you're just wanting cargo to rebuild/update dependencies you can run cargo update.

Related Question