cbron
cbron

Reputation: 4044

Rbenv not working

I installed ruby 2.0 into ~/.rbenv/versions last and now nothing but that is available

$ rbenv versions

system
*ruby-1.9.3-p392 (set by /apps/test_app/.ruby-version)
ruby-2.0.0-p0

$ ruby -v

ruby 2.0.0.p0

$ env | grep PATH

PATH=/home/cbron/.rbenv/shims:/home/cbron/.rbenv/bin

$cat ~/.bash_profile

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

$rbenv global

ruby-1.9.3-p392

$rbenv local

ruby-1.9.3-p392

$rbenv shell

rbenv: no shell-specific version configured

edit: now set the shell, still nothing.

$rbenv shell

ruby-1.9.3-p392

ruby -v still getting

ruby 2.0.0p0

I already sourced my bash_profile, even restarted the computer.

Upvotes: 9

Views: 7126

Answers (3)

mdesantis
mdesantis

Reputation: 8517

Extracted from rbenv readme:

rbenv shell

Sets a shell-specific Ruby version by setting the RBENV_VERSION environment variable in your shell. This version overrides application-specific versions and the global version.

$ rbenv shell jruby-1.7.1

When run without a version number, rbenv shell reports the current value of RBENV_VERSION. You can also unset the shell version:

$ rbenv shell --unset

Note that you'll need rbenv's shell integration enabled (step 3 of the installation instructions) in order to use this command. If you prefer not to use shell integration, you may simply set the RBENV_VERSION variable yourself:

$ export RBENV_VERSION=jruby-1.7.1

So in order to use it you need to specify the ruby version as rbenv shell argument (f.e. rbenv shell 2.0.0.p0, or set RBENV_VERSION (f.e. export RBENV_VERSION=2.0.0.p0)

Upvotes: 1

Madacol
Madacol

Reputation: 4316

TL;DR: just reinstall rbenv, unless you are as stubborn as me...


I had messed up permissions in the .rbenv folder, so the shims weren't loading because they didn't have execute permissions

chmod u+x ~/.rbenv/shims/*

Disclaimer

I had deeper permissions problems, rbenv wasn't even working, so I did other chmod u+x ... previously

chmod u+x ~/.rbenv/libexec/*
chmod u+x ~/.rbenv/**/bin/*

Probably easier and safer to just reinstall rbenv. But this was fun!

Upvotes: 0

tomr
tomr

Reputation: 1134

I had the same issue using zsh and this fixed it:

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
$ echo 'eval "$(rbenv init -)"' >> ~/.zshenv
$ echo 'source $HOME/.zshenv' >> ~/.zshrc
$ exec $SHELL

So basically moving the lines from profile to env!

Upvotes: 13

Related Questions