capistrano error: no such file to load — openssl (Ruby on Rails)

While setting up capistrano as suggested in Agile Development with Rails (2nd edition), you may run into the following error:
no such file to load — openssl

The full context of the error is below:

$ rake remote:setup
(in [deployment directory])
Capistrano/Rake integration is deprecated.
Please invoke the ‘cap’ command directly: `cap setup’
* executing task setup
* executing “mkdir -p -m 775 [deployment directory] [deployment directory]/releases [deployment directory]/shared [deployment directory]/shared/system &&\n mkdir -p -m 777 [deployment directory]shared/log &&\n mkdir -p -m 777 [deployment directory]/shared/pids”
servers: [“hostname”]
rake aborted!
no such file to load — openssl

On Ubuntu 6.06 (LTS) this means that the openssl ruby interface is missing, and that it needs to be installed:

$ sudo apt-get install libopenssl-ruby1.8

From the apt-cache description: libopenssl-ruby1.8 – OpenSSL interface for Ruby 1.8


20 responses to “capistrano error: no such file to load — openssl (Ruby on Rails)

  1. Thanks for the post. Only thing that took me a little while to get was that I didn’t have universe repositories enabled. Once I figured that out this fixed the error.

  2. mikong

    The same error occurred when I was trying to run rake test for actionpack (I was about to submit a doc patch for Rails source code).

    Thanks :)

  3. kb

    Thanks! Just what i needed…

  4. geboi

    the same error occured when i run rake db:migrate.
    no such file to load — openssl

    i just install libopenssl before:
    Install these packages without verification [y/N]? y
    Get:1 gutsy/ libopenssl-ruby1.8 [316kB]
    Fetched 316kB in 0s (1475kB/s)
    Selecting previously deselected package libopenssl-ruby1.8.
    (Reading database … 125102 files and directories currently installed.)
    Unpacking libopenssl-ruby1.8 (from …/libopenssl-ruby1.8_1.8.6.36-1ubuntu3_i386.deb) …
    Setting up libopenssl-ruby1.8 ( …


  5. alfredo

    thanks a lot from argentina! absolutly helpful

  6. Jyothi K

    Thanks a ton! it just solved the problem in a snap.

  7. Charles

    I had the same problem, but I was using CentOS. I installed ruby from scratch, not from a repository. After googling a while I found that extensions must be compiled one by one. In my case, I had to compile openssl and zlib. Steps:
    1. Go to $RUBY_INSTALLER_DIR/ext/
    2. Type “ruby extconf.rb”
    3. make & make install

  8. Nimesh

    Thanks a ton!!!

    I really require this solution….:)

  9. novhak

    thanks for the help !

  10. For me this meant “install the libssl-dev package then recompile ruby” (or, if you don’t have time, just touch openssl.rb in your pwd)

  11. drp

    even four years later it still works …

    thx so much :)

    Ubuntu 10.4
    ruby 1.8/1.9
    capistrano 2.5.5

  12. For me on Ubuntu 10.10, rvm, ruby 1.8.7, rubygems 1.4.2 for the same openssl error but not for capistrano, I was required to install libssl-dev

    Thanks for the hint @roger!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: