Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get capistrano working with rvm and passenger standalone. I had it working at one point, then capistrano suddenly started complaining about missing the bundle command. When I remove require 'bundler/capistrano', it no longer complains about missing bundle (and no longer attempts to bundle) but fails with the following:

* 2013-07-25 14:29:16 executing `deploy:restart'
* executing "if [[ -f /home/staging/capistrano/shared/tmp/pids/ ]];\\\n      then\\\n        cd /home/staging/capistrano/current && rvmsudo passenger stop -p 80;\\\n      fi"
  servers: [""]
  [] executing command
** [out ::] sh: 1:
** [out ::] [[: not found
** [out ::]
  command finished in 13ms
* executing "cd /home/staging/capistrano/current && rvmsudo passenger start -e staging -p 80 -d"
  servers: [""]
  [] executing command
** [out ::] sh: 1:
** [out ::] rvmsudo: not found
** [out ::]
  command finished in 13ms
failed: "env rvmsudo_secure_path=1 sh -c 'cd /home/staging/capistrano/current && rvmsudo passenger start -e staging -p 80 -d'" on

It seems evident that there's some path variable missing from the shell environment of my deploy user, but only when called from capistrano. All the commands in question work manually. I'm not sure where to start looking. The env rvmsudo_secure_path=1 is a result of default_run_options[:env] = {'rvmsudo_secure_path' => 1} at the top of staging.rb which stops an rvm error from showing and hanging the deploy process. It was present before when deploying worked.

share|improve this question
up vote 1 down vote accepted

bundler/capistrano default settings are not always the best choice, this is why it is recommended in rvm-capistrano to reset those settings back to using standard ruby paths (called system in bundler - but has nothing to do with system itself)

I maintain example application the minimal extract fro you would be:

require "rvm/capistrano"
require "bundler/capistrano"

set :bundle_dir, ''
set :bundle_flags, '--system --quiet'
set :bundle_without, [:development]
share|improve this answer
So with rvm-capistrano, how do I automate the bundle install task? – Archonic Jul 29 '13 at 13:59
updated and added example – mpapis Jul 30 '13 at 1:40
Ah, that's what I needed. Thanks! – Archonic Jul 30 '13 at 19:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.