How can I specify a local gem in my Gemfile? How can I specify a local gem in my Gemfile? ruby ruby

How can I specify a local gem in my Gemfile?


I believe you can do this:

gem "foo", path: "/path/to/foo"


In addition to specifying the path (as Jimmy mentioned) you can also force Bundler to use a local gem for your environment only by using the following configuration option:

$ bundle config local.GEM_NAME /path/to/local/git/repository

This is extremely helpful if you're developing two gems or a gem and a rails app side-by-side.

Note though, that this only works when you're already using git for your dependency, for example:

# In Gemfilegem 'rack', :github => 'rack/rack', :branch => 'master'# In your terminal$ bundle config local.rack ~/Work/git/rack

As seen on the docs.


You can also reference a local gem with git if you happen to be working on it.

gem 'foo',  :git => '/Path/to/local/git/repo',  :branch => 'my-feature-branch'

Then, if it changes I run

bundle exec gem uninstall foobundle update foo

But I am not sure everyone needs to run these two steps.