Search code examples
rubyrbenvpry

Pry running with obsolete Ruby version


When I type pry -v I get

Pry version 0.12.2 on Ruby 2.3.0

whereas ruby -v gives

ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]

and rbenv global and rbenv local both give

2.6.0-rc2.

I tried uninstalling and reinstalling pry as suggested in an answer to how to change ruby version in Pry.


Solution

  • You can have pry installed as a global executable, from the system ruby. This won't be overridden by any ruby installed by rbenv, unless the pry gem is installed in that specific ruby version.

    It's just a matter of the system searching $PATH for an executable file called pry.

    Most probably, if you gem install pry under rbenv, then the new pry will use the correct ruby binary.

    EDIT:

    Whops, @tadman's comment has exactly the same content. If it is converted to an answer I will delete mine.