2

I tried to install a gem by using gem-install command in pry, but it failed.

% pry
pry(main) > gem-install pry-doc
NoMethodError: undefined method `split' for nil:NilClass
from /Users/ironsand/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/rubygem.rb:60:in `install'

I could install the gem by using gem command from bash. Is there something I must configure to use gem-install command in pry?

1
  • Thanks, that was a fun short code dive! Commented Jul 11, 2015 at 7:24

1 Answer 1

2

I hadn't used PRY for a while.

Looking through the source code found the gem-install command code.

Look at your Gem.configuration['gem'] and you will find that it is nil.

It looks like this comes from your ~/.gemrc settings or default values.

In your ~/.gemrc file, if you place the line gem: ''

This solved the issue for me as it is no longer doing the split on nil, but on the assigned value for gem: key in the .gemrc file.

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

3 Comments

Thanks! and I confirmed this bug is already fixed in github latest revision.
Not published on the rubygems site as of this date though, I guess.
Huge thanks! I found this happens with the latest Pry with OSX, it's been driving me crazy for some time now.

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.