Rails 3: Passenger can't find git gems installed by bundler
Im used to have this problem, resolve using
bundle --deployment
Which will install the gems in vendor/bundle
Solution (took me a few hours):
Mare sure that RAILS_ROOT/.bundle/config
(SetEnv etc. didn't work for me) contains:
--- BUNDLE_PATH: /home/xxxxx/.bundler
Note BUNDLE_PATH, not BUNDLER_PATH! There was also an DISABLED_SHARED_GEMS=1 entry, I removed it.
Then bundler recognises the correct path even when loaded from Passenger. Without Passenger, it always worked (and used /home/xxxxx/.bundler, as said in the question)
You can use bundle install --path vendor/bundle
to install the gems locally, instead of into system gems.
If you want to keep using system gems, though, it's just one line in your Apache configuration to tell Passenger where to find your system gems:
SetEnv GEM_HOME /Users/bob/.bundle
There's a slightly more elaborate writeup on my blog at Using Passenger with GEM_HOME set