0

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.

3
  • 1
    If your system supports it, which pry for one will tell you where pry is coming from. You may want to gem install pry. Commented Jan 30, 2019 at 16:51
  • which pry points to a bash script at ~/.rbenv/shims/pry. Pry should be taking its cues from rbenv. Commented Jan 30, 2019 at 16:57
  • That should be it, so rbenv seems to be letting you down. Commented Jan 30, 2019 at 17:30

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Interesting. gem install pry worked this time. Can't think of anything I did differently from last time, except for not uninstalling before reinstalling.
This is a much longer explanation than mine, so it's all good.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.