Have you seen this error:
Usually I write exclusively about Ruby on this site, and that may change in the near future, but today’s post is brought on by hours of painful troubleshooting I had to endure in order to get a functional Ruby on Rails environment setup on my Debian install. In short, for some reasons OpenSSL wasn’t already included in all the other packages I installed so I was forced to do a complete reinstall of Ruby in order to run Rails. Don’t worry, it’s fixable and I will walk you through it.
If you’re getting the same error I got, then when you run:
The script starts generating the usual project scaffold, but it ends with a Bundler error. Here was the output of the last command the rails new as failing for me:
Well, I did what they asked. I made a ticket, and got a reply to look at a different ticket. So I went to that ticket, and it turns out fresh installs of rails are failing all over the place for Debian & Ubuntu users (linux in general I guess).
The solution: Install OpenSSL and then Recompile Ruby
The problem: How the hell do I do that?
This is what took forever. I tried alot of things. Must’ve reinstalled a dozen times. Eventually, I got things straightened out. Lucky for you, you won’t need to endure. I will spill the beans.
- Make sure you have RVM installed. If you don’t, then look it up and get started. Now that I have it setup and have seen how much it helps, I am not even going back. I will always use RVM to manage my ruby packages on Linux from now on. I can’t explain here because that is a whole new post.
- Before installing Ruby or Rails, you need to install the OpenSSL package and then you can compile Ruby with that package. If you already have Ruby installed then you need to run this first:
rvm remove 1.9.3
- To do that use this command:
rvm pkg install openssl
- Now, we are all set to reinstall Ruby — this time, with the OpenSSL package so we don’t get those errors. The command is:
rvm install 1.9.3 --with-opensll-dir=$HOME/.rvm/usr
- Lastly, we make sure to set a default:
rvm use 1.9.3 --default
That’s it! That should fix the OpenSSL error and allow Bundler to run correctly using HTTPS.
I ran into 1 more issue before I could get my RoR environment fixed up. I had to install the ‘execjs’ gem and the ‘therubyracer’ gem. This was due to some kind of Javascript Runtime error. I added these two gems to my gemfile and everything was ready to go. Compared to the OpenSSL issue this was a breeze.
To test this all out, create a new rails project, ran a migration, and then started the rails server. Here are the commands to do this:
Then cd into that folder, and then run
Now, start the server with
If you can see the welcome page at http://localhost:3000 then you are all set!
That is all! Hope you’re installation of Rails went more smoothly than mine.
Posted: May 6th, 2012 under Rails Troubleshooting.

