cbmeeks
cbmeeks

Reputation: 11420

How do I install a Ruby gem from GitHub and have it work in IRB?

Seems like every Ruby tutorial I find centers around Rails.

Anyway, I simply want to install a gem from a GitHub repo and have that gem work in irb.

I want to install the exifr gem. When I do a gem install exifr it doesn't get the newest version.

So I created a Gemfile and put:

gem 'exifr', :git => 'git://github.com/remvee/exifr.git'

Then bundle install. Installs OK but now gem list doesn't find the gem. So I can't require it in irb.

Any help for NON Rails applications?

Thanks

Upvotes: 2

Views: 2139

Answers (2)

Chris Heald
Chris Heald

Reputation: 62698

You need to kick off the bundler setup if you want to use the gems from a gemfile:

require 'bundler/setup'
require 'exifr'

or:

irb -rbundler/setup
> require 'exifr'

This is equivalent to running bundle exec irb, except it doesn't depend on a specific invocation to work, and instead presumes that a Gemfile is available and the gems were installed with Bundler.

Upvotes: 4

Philip Hallstrom
Philip Hallstrom

Reputation: 19899

Try...

bundle exec gem list

And..

bundle exec irb -rexifr

And see if that works. That should help gem/irb find the installed gem.

Upvotes: 0

Related Questions