How to use Bundler with offline .gem file?

Try unpacking the gem and then using the path in your Gemfile.

i.e.

gem unpack my-gem-file.gem /my-rails-app/vendor/gems/

then add a line like so to your Gemfile

gem 'my-gem', '0.0.1', :path => 'vendor/gems/my-gem'

Obviously paths and version numbers will vary. You also might need to make the vendor/gems directory in your app root if it doesn't already exist.


Copy the gem in to vendor/cache directory in your application's root folder.

bundle install --local

This will install the local gem.


I'm using Rails 3.0.3, new to Rails 3 and bundler.

I got this same error with:

gem 'mygem', :path => '/path/to/gem'

Resolved by specifying the version number:

gem 'mygem', '0.0.1', :path => '/path/to/gem'

Using >=0.0.1 for the version reverted to the original error. I can't explain any of this, however.

Quoting JD's helpful commment, from the Gemfile man page: "Similar to the semantics of the :git option, the :path option requires that the directory in question either contains a .gemspec for the gem, or that you specify an explicit version that bundler should use."