rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

rustling rampup for .asdf users

Open Liferenko opened this issue 1 year ago • 4 comments

Hello! I guess we need to add in README an info how to start when your Rust has been installed via asdf.

It wasn't that obvious from first glance why rustlings run tests1 said zsh: commang not found: rustlings. I've added $PATH in my .zshrc - did not help.

Looks (and feels) like the core of the problem lays somewhere in .asdf because I've installed rust via ASDF. I bet I'm not the only one who faces this asdf-related issue at the step 0 of rust journey.

> dotfiles git:(master): rustlings
> zsh: command not found: rustlings
> dotfiles git:(master): which cargo
> /Users/macbook/.asdf/shims/cargo

Liferenko avatar May 28 '23 02:05 Liferenko

Looks like if you've installed Rust via asdf, the PATH should look like this export PATH=/Users/username/.asdf/shims:$PATH

because the last few sentences in rustlings/install.sh said WARNING: Please check that you have '/Users/macbook/.cargo/bin' in your PATH environment variable!

Is it correct?

Liferenko avatar May 28 '23 02:05 Liferenko

I am getting a similar error. I have asdf rust installed with cargo version 1.71.0, rustup 1.26.0. Both are in the /Users/user/.asdf/shims/. path when I run the which command.

Install works without error, but can't run the program...

%> rustlings
zsh: command not found: rustlings

Workaround

As a work around, it shouldn't surprise one to find the release binary in the [path to rustlings]/rustlings/target/release directory. I just call this direct e.g. ./target/release/rustlings list

hope that helps...

pkbyron avatar Jul 29 '23 06:07 pkbyron

I will say that I am of the general opinion that Rust, if not installed via a system package manager, should be installed via Rustup, as it's the project's official tool, and also includes a release track and components system, which is indispensable for advanced uses. I'm not sure how asdf handles shims, but unless they actually modify Cargo's source code, Cargo will always install binaries into ~/.cargo/bin.

shadows-withal avatar Jul 30 '23 18:07 shadows-withal

I had this issue as well I fixed it by configuring the PATH variable with asdf path to the rust version and the shims folder. export PATH=$HOME/.local/bin/:/usr/local/bin/:$HOME/.asdf/installs/rust/stable/bin/:$HOME/.asdf/shims/:$PATH After this I executed the script to install the rustlings again and it worked

rochaalexandre avatar Oct 29 '23 14:10 rochaalexandre

I am getting a similar error. I have asdf rust installed with cargo version 1.71.0, rustup 1.26.0. Both are in the /Users/user/.asdf/shims/. path when I run the which command.

Install works without error, but can't run the program...

%> rustlings
zsh: command not found: rustlings

Workaround

As a work around, it shouldn't surprise one to find the release binary in the [path to rustlings]/rustlings/target/release directory. I just call this direct e.g. ./target/release/rustlings list

hope that helps...

In my case, this is ths solution! Thank you!

mansorkonrrado avatar Jan 11 '24 19:01 mansorkonrrado

Closing because of the solution in the comments.

mo8it avatar Mar 30 '24 16:03 mo8it