rustrust-cargo

How can I install an executable from a local project systemwide?


Suppose I have a successful build:

$ cargo build --release
...
Finished release [optimized] target(s) in 2m 52s

Is there a way to make it available to the system user right away, without uploading to registry?

With Python, for instance, it looks like this:

myutility $ pip install dist/myutility-0.8.2-py3-none-any.whl --user

myutility goes to cache

/home/user/.local/bin/myutility

and is awailable anywhere:

~ $ myutility --help

How am I supposed to go about something like this with Rust (and cargo)?


Solution

  • You can do

    $ cargo install --path .
    

    to have cargo compile in release mode and install the crate in the current directory. This makes Cargo install it to ~/.cargo/bin.