How to specify local Ruby gems in your Gemfile

Sometimes for development you need to test out a gem locally from another project and this article does a great job explaining how to do just that:

TL;DR

You can use path:

gem "tacokit", path: "/path/to/tacokit"

but you should use bundle config instead:

bundle config --local local.tacokit /path/to/tacokit

to avoid accidentally committing your temp change to production.

Follow up (now that I’m actually trying to do it):

It appears that the bundle config route can only point to external git repos (like github), but not local paths, so it appears the best option is still to just use path: and modify the Gemfile :frowning_face:. Be sure not to commit these changes in your Gemfile!

So after adding path: in my Gemfile for my gem, I then uninstalled it with gem uninstall rswag-specs and then ran bundle install which produced this in the output:

Using rswag-specs 0.0.0 (was 2.3.1) from source at `/home/blake/code/rswag/rswag-specs`