title: Deploying to RVM-enviroment with Capistrano (RoR App)
body: <p>I've been looking around a lot for answers to my problem but I can't find a solution that works...so here is my first post ever on stackoverflow!</p>
  
  <p>A while ago I setup an apache server with RVM in order to host one of my client's website. By then, my development environment also had ruby installed through rvm. In the meanwhile, I changed my development environment and now started using VM VirtualBox with Ubuntu, and installed ruby directly from source using <code>apt-get install ruby</code>. I've used Capistrano to deploy all my projects.</p>
  
  <p>Now I've done some work back on that project, but when I tried to deploy it to the production server, I get this error:</p>
  
  <pre><code>2013-07-08 08:12:50 executing `bundle:install'
  * executing "cd /var/www/project/releases/20130708061242 &amp;&amp; bundle install --gemfile /var/www/project/releases/20130708061242/Gemfile --path /var/www/project/shared/bundle --deployment --quiet --without development test"
      servers: ["xxx.xx.xxx.xxx"]
      [xxx.xx.xxx.xxx] executing command
  *** [err :: xxx.xx.xxx.xxx] tput:
  *** [err :: xxx.xx.xxx.xxx] No value for $TERM and no -T specified
  *** [err :: xxx.xx.xxx.xxx] 
  *** [err :: xxx.xx.xxx.xxx] tput:
  *** [err :: xxx.xx.xxx.xxx] No value for $TERM and no -T specified
  *** [err :: xxx.xx.xxx.xxx] 
   ** [out :: xxx.xx.xxx.xxx] ERROR: Gem bundler is not installed, run `gem install bundler` first.
      command finished in 818ms
  *** [deploy:update_code] rolling back
    * executing "rm -rf /var/www/project/releases/20130708061242; true"
      servers: ["xxx.xx.xxx.xxx"]
      [xxx.xx.xxx.xxx] executing command
      command finished in 693ms
  failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'cd /var/www/project/releases/20130708061242 &amp;&amp; bundle install --gemfile /var/www/project/releases/20130708061242/Gemfile --path /var/www/project/shared/bundle --deployment --quiet --without development test'" on xxx.xx.xxx.xxx
  </code></pre>
  
  <p>I also have my own testing server and I have no problem when deploying on this one (which has rbenv instead).</p>
  
  <p>Server end stuff is my least knowledgeable area :) Let me know if I can give any additional information that you might need.</p>
  
  <p>Thanks!</p>
  
  <p>EDIT</p>
  
  <p>Here is my deploy.rb</p>
  
  <pre><code>require "bundler/capistrano"
  require "rvm/capistrano"
  
  server "xxx.xx.xxx.xxx", :app, :web, :db, :primary =&gt; true
  
  set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
  set :rvm_install_ruby_params, '--1.9'      # for jruby/rbx default to 1.9 mode
  set :rvm_install_pkgs, %w[libyaml openssl] # package list from https://rvm.io/packages
  set :rvm_install_ruby_params, '--with-opt-dir=/usr/local/rvm/usr' # package support
  
  before 'deploy:setup', 'rvm:install_rvm'   # install RVM
  before 'deploy:setup', 'rvm:install_pkgs'  # install RVM packages before Ruby
  before 'deploy:setup', 'rvm:install_ruby'  # install Ruby and create gemset, or:
  before 'deploy:setup', 'rvm:create_gemset' # only create gemset
  before 'deploy:setup', 'rvm:import_gemset' # import gemset from file
  
  #General settings
  set :ssh_options, { :forward_agent =&gt; true }
  set :application, "project"
  set :repository,  "git@repo.com:project.git"
  set :deploy_to, "/var/www/#{application}"
  set :deploy_via, :remote_cache
  
  set :scm, :git
  set :scm_user, "deploy"
  set :user, :deploy
  set :use_sudo, false
  set :keep_releases, 5
  
  after "deploy:update_code", "deploy:migrate"
  load "deploy/assets"
  </code></pre>