Why does 'bundle' install production gems on my development machine?
Asked Answered
K

1

20

Gemfile says:

gem 'sqlite3', :groups => [:development, :test]
gem 'mysql2', :group => :production

yet when I type bundle install on my development machine ALL gems are installed.

What's wrong with my setup?

Karlene answered 6/8, 2011 at 0:1 Comment(0)
S
28

The point of Bundler is to create a consistent gem environment across deployments. Gems, unfortunately, can interact even if they aren't loaded or required. So for maximum consistency, all gems should be installed, even if they aren't all required.

However, if you don't want all gems installed all the time, you can use the bundle install --without option.

Silverweed answered 6/8, 2011 at 0:14 Comment(2)
FWIW: I now use bundle install --without production on my development machine(s). It's a remembered trait so --without production only needs to be typed once.Karlene
What happens in production later on? If you only install the gems without production and it's a remembered trait, how do you install gems in production later on when you are ready to deploy?Gamache

© 2022 - 2024 — McMap. All rights reserved.