How to keep running Capistrano 2

12,182

Solution 1

In your Gemfile, change your reference to Capistrano to the last version published in 2.0 (as of this writing).

group :development do
  gem 'capistrano', '~> 2.15.9'
  #other development gems...
end

On your local machine, make sure you have that version installed

gem install capistrano -v 2.15.9

Solution 2

You can run gem wrapper scripts using a version specifier.

The following should run capistrano 2.x, if it's installed (see `gem list --local´):

cap "_<3_" --version
Share:
12,182
creativereason
Author by

creativereason

Hybrid developer &amp; designer. Formerly Java / C#, then Ruby, Angular, React Native, etc.. Co-founder at Spoke Marketing, BarrelFish, and Triumph Software. Now CXD, Digital Design &amp; Enablement at Centric Consulting. Mostly UI / UX now.

Updated on June 09, 2022

Comments

  • creativereason
    creativereason almost 2 years

    With Capistrano 3 out and Mavericks and Yosemite released... or if you had a recent clean install on of Rails and Capistrano on your development machine you may end up getting errors when trying to deploy a Rails 3.X app due to your machine having Capistrano 3.0 being installed.

    If you are getting errors about Capistrano 3 being unable to read your deploy.rb file...

  • Federico
    Federico about 10 years
    Very useful! For those of us who don't have a ruby project but use capistrano there is no gem file to edit. Also the following commands could be useful: "gem which capistrano" and "gem env"
  • pastullo
    pastullo about 10 years
    On an old project i still run capistrano 2, but i get the error above. My gem file uses 2.15.5 but "gem which capistrano" shows capistrano v3. How can i force to run on capistrano 2?
  • creativereason
    creativereason about 10 years
    @pastullo did you try running bundle install to create a new Gemfile.lock?
  • creativereason
    creativereason about 10 years
    so which version shows in your Gemfile.lock? Can you try gem list to see which versions are installed?
  • meze
    meze almost 10 years
    If you aren't doing ruby, then you can run cap _2.15.5_ deploy after the gem is installed.
  • Trey Copeland
    Trey Copeland about 8 years
    @creativereason i need capistrano 2 for my old app. gem which capistrano says 3, but everything else (gem list(says 3.2.1, 2.15.5), gemfile, gemfile.lock) all say 2.15.5. thoughts?
  • creativereason
    creativereason about 8 years
    @TreyCopeland how is it referred to in your Gemfile? Do you manually reference 2?
  • Trey Copeland
    Trey Copeland about 8 years
    @creativereason yes, i have gem 'capistrano', '~> 2.15.5'
  • mwfearnley
    mwfearnley over 7 years
    It looks like the latest is Capistrano 2.15.9 now. rubygems.org/gems/capistrano/versions/2.15.9 (I checked the source at github.com/capistrano/capistrano/tree/legacy-v2)