Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rbenv shell not command

rbenv installed. but rbenv shell not command.

ationtekiMacBook-Air:~ dation$ rbenv versions
  system
* 2.0.0-p247 (set by /Users/dation/.ruby-version)
dationtekiMacBook-Air:~ dation$ rbenv version
2.0.0-p247 (set by /Users/dation/.ruby-version)
dationtekiMacBook-Air:~ dation$ rbenv shell
rbenv: no such command `shell'

ationtekiMacBook-Air:~ dation$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
like image 756
sottish Avatar asked Dec 06 '22 05:12

sottish


2 Answers

There is this note in rbenv's README (see Installation) about the shell command:

Note that you'll need rbenv's shell integration enabled (step 3 of the installation instructions) in order to use this command.

Step 3 is:

Add rbenv init to your shell to enable shims and autocompletion.

$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Same as in previous step, use ~/.profile on Ubuntu, ~/.zshrc for Zsh.

Did you follow that instruction?

like image 54
spickermann Avatar answered Jan 12 '23 12:01

spickermann


one gotya that I haven't seen posted on the internet is that in .bash_profile, you have ensure that

export PATH="$HOME/.rbenv/bin:$PATH"

is placed before

eval "$(rbenv init -)"

Otherwise the shell will try to run rbenv init before it can be found.

Reversing these two lines will cause both problems described by the OP;

ruby -v not showing the version that was set by rbenv

rbvenv shell returning "rbenv: no such command `shell’".

Don't ask how I know!

I today opened an issue in Github to propose an update to sstephenson's already awesome documentation.

like image 25
Paul S Avatar answered Jan 12 '23 14:01

Paul S