Avoid installing unchanged local crates

A nice feature of cargo install <package> is that will avoid building/installing if the latest published version is not newer than the currently installed version.

However, there are some crates that I install from source because they are not (yet) published. Unfortunately, but for pretty obvious reasons, cargo install --path . will always rebuild and install. What means are there to avoid this, given that I track tagged versions (i.e. I can still use the version number change to determine whether a crate needs to be installed from source).

My immediate instinct is to parse the output of cargo install --list and parse the crate's Cargo.toml for the version and compare them -- but is there a better way to do this?

cargo install package --git url also checks version, and doesn't require publishing to crates.io.

If you only work with checkouts already on disk, you can use cargo build --release, keep the target directory, and copy the executable to some /bin dir yourself.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.