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 deploy octopress on a VPS but getting this error bundle: not found but bundle is installed!

Full error.

$ cap deploy
  * 2013-07-20 18:08:55 executing `deploy'
  * 2013-07-20 18:08:55 executing `deploy:update'
 ** transaction: start
  * 2013-07-20 18:08:55 executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote HEAD"
    command finished in 8348ms
  * executing "if [ -d /home/deploy/ruby_apps/website/shared/cached-copy ]; then cd /home/deploy/ruby_apps/website/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard de26553c0aa7ea583e0bfdec2c103ba83adbb793 && git clean -q -d -x -f; else git clone -q /home/deploy/ruby_apps/website/shared/cached-copy && cd /home/deploy/ruby_apps/website/shared/cached-copy && git checkout -q -b deploy de26553c0aa7ea583e0bfdec2c103ba83adbb793; fi"
    servers: [""]
    [] executing command
^Acssh revers    command finished in 7161ms
    copying the cached version to /home/deploy/ruby_apps/website/releases/20130720123917
  * executing "cp -RPp /home/deploy/ruby_apps/website/shared/cached-copy /home/deploy/ruby_apps/website/releases/20130720123917 && (echo de26553c0aa7ea583e0bfdec2c103ba83adbb793 > /home/deploy/ruby_apps/website/releases/20130720123917/REVISION)"
    servers: [""]
    [] executing command
    command finished in 1868ms
  * 2013-07-20 18:09:19 executing `deploy:finalize_update'
    triggering before callbacks for `deploy:finalize_update'
  * 2013-07-20 18:09:19 executing `bundle:install'
  * executing "cd /home/deploy/ruby_apps/website/releases/20130720123917 && bundle install --gemfile /home/deploy/ruby_apps/website/releases/20130720123917/Gemfile --path /home/deploy/ruby_apps/website/shared/bundle --deployment --quiet --without development test"
    servers: [""]
    [] executing command
 ** [out ::] sh: 1:
 ** [out ::] bundle: not found
 ** [out ::] 
    command finished in 1431ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deploy/ruby_apps/website/releases/20130720123917; true"
    servers: [""]
    [] executing command
    command finished in 1387ms
failed: "sh -c 'cd /home/deploy/ruby_apps/website/releases/20130720123917 && bundle install --gemfile /home/deploy/ruby_apps/website/releases/20130720123917/Gemfile --path /home/deploy/ruby_apps/website/shared/bundle --deployment --quiet --without development test'" on

I did google and found out about cap shell and then I found that the PATH variable isn't probably being set somehow

$ cap shell                                                                                                                                                         1 ↵
  * 2013-07-20 18:16:43 executing `shell'
Welcome to the interactive Capistrano shell! This is an experimental
feature, and is liable to change in future releases. Type 'help' for
a summary of how to use the shell.
cap> echo $PATH
[establishing connection(s) to]
 ** [out ::] /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
 ** [out ::] 
cap> id
 ** [out ::] uid=1003(deploy) gid=1003(deploy) groups=1003(deploy),1005(rvm)
 ** [out ::] 

But when I ssh on

deploy@mydomain:~$ id
uid=1003(deploy) gid=1003(deploy) groups=1003(deploy),1005(rvm)
deploy@mydomain:~$ echo $PATH
deploy@mydomain:~$ grep source .bashrc
# sources /etc/bash.bashrc).
source /etc/profile.d/
deploy@mydomain:~$ rvm list

rvm rubies

   ruby-1.9.3-p429 [ x86_64 ]
=* ruby-2.0.0-p247 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

deploy@mydomain:~$ gem list bundler

*** LOCAL GEMS ***

bundler (1.3.5)
bundler-unload (1.0.1)
deploy@mydomain:~$ gem which bundler

I'm not sure what exactly am I missing here. I also tried adding source /etc/profile.d/ to .bash_login but still no luck.

share|improve this question
up vote 5 down vote accepted

It appears that Capistrano uses non-interactive shell and hence it won't read bashrc.


Added this to deploy.rb

set :default_shell, '/bin/bash -l'
share|improve this answer
interactive / login shell should not be used in automation processes – mpapis Jul 28 '13 at 1:21
Why shouldn't it be used in automation processes? – Jason Yost Feb 6 '15 at 19:12
I have the rvm-capistrano gem and set :default_shell, '/bin/bash -l' and capistrano still can't find the bundle command. – Archonic Oct 26 '15 at 1:47

You should use rvm-capistrano - this projects gives you control over loading rvm and helper tasks like installing rvm or ruby.

share|improve this answer

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.