rbenv / rbenv

Manage your app's Ruby environment
https://rbenv.org/
MIT License
16k stars 1.39k forks source link

Install instructions not clear on how to activate newly installed Ruby version #1424

Closed fulldecent closed 1 year ago

fulldecent commented 1 year ago

I completed the install instructions in the readme and it did not produce the expected result

Screen Shot 2022-09-06 at 15 50 43

Additionally this required me to run a curl | bash shell code which is not best practice.

fulldecent commented 1 year ago

Followed instructions

Screen Shot 2022-09-06 at 15 52 26
hsbt commented 1 year ago

You could install 3.1.2 correctly. You need to learn to use bundler and version management of rbenv, not installation.

fulldecent commented 1 year ago

You are correct, but not helpful.

People are using rbenv because they want to set up and use Ruby, not because they want to learn about version management of rbenv.

The default install instructions of Ruby says to install Ruby, click here, and then they are directed to the rbenv instructions I have referenced above.

So the install instructions for rbenv would be more helpful and live up to the esteem that Ruby-Lang.org places on it by ending with a usable Ruby installation. As my issue above shows, this is not currently the case.

mislav commented 1 year ago

@fulldecent Thank you for raising this issue. I will reopen this because it's a common pitfall with new rbenv users that their system Ruby version will still be selected as default even after they've just installed a Ruby version. Our users often do not understand that they need to use rbenv global <VERSION> or rbenv local <VERSION> to actually activate the Ruby version they've just installed. https://github.com/rbenv/rbenv/issues/1094#issuecomment-396259530

Another common installation pitfall is clearing the rbenv init step so that rbenv is properly loaded in the shell (if needed) and that rbenv shims directory is added to PATH https://github.com/rbenv/rbenv/issues/1193

I think rbenv should do more to help users around these issues and hopefully reduce frustration.

fulldecent commented 1 year ago

Thank you, rbenv global ... worked for me. Here's a few ideas:

  1. rbenv install can include a banner (in color) if rbenv is not currently enabled (explain to use rbenv global/local)
  2. rbenv-doctor can say no shims if there are no shims in the path (failed as per screenshot above)
  3. rbenv-doctor can more clearly say "Your RBENV is not active... (red/fail)" or clearer language that action is required
  4. rbenv-doctor should be built into rbenv, it should not require a separate shell code hack which turns control of my entire computer over to anybody that controls github.com, the bin/rbenv-doctor file, anybody that can forge certificates on behalf of the trusted CAs in my toolchain, or anyone that can successfully perform a QUANTUMINSERT attack
  5. rbenv init should perform its own checking and inform that an install / global / local needs to be performed
  6. rbenv init should ask you to install a ruby version, with the latest stable version preselected (if one is not already installed)
  7. rbenv install should default to the -l option with "The following versions are available. Use rbenv install VERSION to install a specific version."