`cargo install` not installing binary globally

I published my first crate on crates.io, its a simple octad puzzle generator (soon featuring solving).
I tried installing the binary through this command:

cargo install octad

which supposedly installs the binary globally.
However, I can't call "octad" from my terminal. I recall installing Zellij using cargo install a while ago, and that just worked, however this does not.
Thanks in advance, I'm generally pretty new to Rust.

Can you see the octad binary in your $CARGO_HOME/bin/[1] directory?


  1. On Linux the $CARGO_HOME directory defaults to $HOME/.cargo/ ↩︎

I can. Also, I should mention that I am using NixOS, which may change how some things work.

Never used NixOS, so I'm not sure if there is any significant difference to other Linux distros. You are still using a common shell like bash or zsh though, right? Can you see the $CARGO_HOME/bin/ directory in your $PATH?

I am using a traditional shell (more specifically, zsh), but I can't see the directory in the $PATH.
I probably should add it into there, I suppose?

Yes. Rustup added this line to my ~/.profile file during installation, which prepends the bin/ directory from the cargo home to my path:

. "$HOME/.cargo/env"

I believe zsh doesn't load ~/.profile, but AFAIK you can simply add the line to your ~/.zprofile or ~/.zshrc file and the directory should be added to your path in zsh as well.

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.