Take the 2-minute tour ×

After finally managing to get my Rails app working, I've got stuck with a slightly perplexing problem. I've deployed my Rails 3.0.5 app to a Ubuntu 10.10 server with Capistrano, RVM and Nginx. All is working nicely and I can confirm Rails is working as I'm getting data from the database and meaningful log messages.

The problem is that on the server, I can't access the console. When I try

rails c

It says "The program 'rails' is currently not installed. To run 'rails' please ask your administrator to install the package 'rails'"

However it is installed otherwise my application wouldn't work! I've only got two RVM gemsets installed, the global one and one called "rails305". Trying

rvm gemset use rails305


gem list

doesn't show any of the gems that my app needs, however they must be installed because 1) the app wouldn't work without them and 2) in my Capistrano deploy script, bundler installs them (to that gemset). So the problem is obviously something to do with RVM but I can't work out what it is... anyone any ideas?

share|improve this question
It sounds like Passenger is using a different ruby than your terminal session is. Do you have multiple rubies installed? Did you follow the RVM/Passenger info from here? You can quickly see all the ruby/gemset combinations by looking in ~/.rvm/gems. –  krohrbaugh Mar 16 '11 at 21:54
No, only have the one ruby at the moment. I looked around in those folders but still couldn't find the gems - however someone on the rvm channel on irc gave me the answer (posted below) –  fishwebby Mar 17 '11 at 15:23

2 Answers 2

up vote 12 down vote accepted

It looks like Capistrano uses bundler so you might want to try

bundle exec rails c

from the deployment directory.

See the Bundler deployment page for more information.

share|improve this answer
Yes! This worked nicely (although I added "production" to the end to get it to load that environment) - thank you! :-) –  fishwebby Mar 17 '11 at 15:25

Bundler by default doesn't install gems into the default rvm environment when deployed via capistrano, it installs to the "shared/bundle" directory instead, to try and accommodate production installation environments that aren't using RVM. If you are using RVM in production, and want to just have bundler install to your default ruby/gemset (which is terribly useful if you are going to be logging into the production, running rake scripts, console, etc), add the following options to your config/deploy.rb:

set :bundle_dir, ""
set :bundle_flags, ""

This will remove the "--deployment" (and "--quiet", which you may or may not want to keep) and --path flags which cause bundler to try and package everything up nicely, so bundler will now install to the user's RVM environment; making your server environment work a lot more like your dev environment (which can be good or bad depending on what your needs are).

share|improve this answer

Your Answer


