Search code examples
rustrust-cargo

How can I downgrade or install an older version of a tool I installed with `cargo install`?


I would like to install Xargo v0.3.10 on my machine. The current version of Xargo is v0.3.11 and it is installed by the cargo install xargo command. How can I install an older version of Xargo?


Solution

  • cargo install --version 0.3.10 xargo

    Reading the help for the cargo tool is very useful:

    $ cargo install --help
    cargo-install
    Install a Rust binary
    
    USAGE:
        cargo install [OPTIONS] [--] [crate]...
    
    OPTIONS:
            --version <VERSION>      Specify a version to install from crates.io
    
    [... snip ...]
    

    If you wish to downgrade the version of the tool, you'll need to add the -f / --force flag:

    -f, --force                  Force overwriting existing crates or binaries
    

    See also: