The problem with installing the gem that way is that you're shelling out to another process with:
`gem install rubyzip`
and after that finishes installing the gem, your current irb
session still won't see it. You'd have to reload irb
with exec "irb"
and then calling require 'zip'
again.
Note: those are backticks not single quotes.
Try this:
begin
require 'zip'
rescue LoadError
`gem install rubyzip`
exec "irb"
retry
end
For me require 'zip'
works. I have rubyzip-1.1.2
Now you should be able to use Zip
Also, the gem
command is rubygems. So you can't install rubygems with itself. It should already be installed, but if not try this: http://rubygems.org/pages/download