Globally available Gemfile

bundler, gemfile, ruby, ruby-on-rails

Solution

Make a Gemfile as usual, and place it in any folder. It does not need to be a project folder. Then you can just do:

bundle install --system

This will install the gems in the Gemfile system-wide, and will ask for the root password if you do not have access to the system folder.

--system: Installs the gems in the bundle to the system location. This overrides any previous remembered use of --path.

You can also name your Gemfile(s), if you want to organize them in some way:

bundle install --system --gemfile=/path/to/my_special_gemfile

Problem

I have numerous gems that I use across all Rails projects, but that aren't part of the projects' Gems, for example powder for managing POW. It would make sense to me to manage these with a global Gemfile, but I can't see any examples of this. How should I manage global Gems that I don't want in my project gemfiles? It would be good to have a single point of install for when I set up a new machine etc. I'm using chruby alongside ruby-install to manage my Ruby versions.

Original source

Related problems