Hello Reader (yes there’s only one of you).
I’ve been doing some Rails development because I like it and think it’s a skill worth learning, what I don’t like is having to spend 300 hours in the terminal just to figure out how I can at least create a new app. I have however figured out how to get some errors that I’ve found during my installation experience of Rails fixed so read on below to learn about my error with Ruby, RVM and missing gemsets.
When I started playing with Rails I used 1.9.2 and this was good and fun but when 1.9.3 came out I wanted to get on that gravy train so like I had done. I opened up terminal and used $ rvm upgrade 1.9.2-p198 1.9.3 I cannot remember what patch number I was using so just go with it.
This upgrade went through perfectly and downloaded, compiled and looked great. I then created a gemset using
$ rvm use 1.9.3@testgemset --create
Once again it worked (far too uncommon for a Ruby installation).I’ve then tried to install the rails gem
$ sudo gem install rails 3.2.3
This didn’t work. Failed. Wonderful, I thought. I spent a few hours debugging and flailing around the internet and IRC trying to find any solution, I had multiple people tell me to reinstall and get the dependencies, people were lost and nobody could help me. Rails eventually installed but when I tried to use
$ rails -v
I was still getting my older version (3.0.2). This was really frustrating so I thought that I might have to change gemsets so I used
$ rvm gemset list
to view all my available gemsets but mine wasn’t there. After hours and hours the solution ended up being that I was still using Ruby 1.9.2 because RVM had defaulted back so all I had to change was, the reason this didn’t work is that gemsets are specific to the version of Ruby they use and because I had created my gemset with 1.9.3 and I was using 1.9.2 my gemsets were not available (quite a handy tool if you know about it).
$ rvm --default use 1.9.3 $ ruby -v
That showed 1.9.3 and fixed my issue, I had reinstalled x code about 5 times and recompiled everything on my system an innumerable amount of time and all I had to do was change the RVM default. Before you start taking apart your system just make sure the that you’re using the right version of Ruby. This post uses horrible English so I apologize for that but if it helps you let me know and if you’ve got any other Ruby tips let me know.