This is a situation when you have updated the OS from a previous version of Mac OSX to the latest version of the OSX Mavericks. Generally OSX ships with a version of Ruby, which is latest by the time the OS is released. But when it comes to OSX upgrade and in this case particularly to OSX Mavericks, the operating system upgrade does not bring in the Ruby upgrade. Rather, the old Ruby lives on the new OSX. Well, if you have a decent understanding of managing Ruby versions, you may be using one of the version management systems of Ruby. I used to have rvm. Now I have an upgraded OSX but need to have the latest version of Ruby. The steps are as below
Well, there are issues with these two steps as I found throughout the net. A simple search in the internet will make you aware of this fact. So the refined steps are as below.
In my case, I do not have to install the XCode commandline tools, probably because I am an iOS developer and always updates to the latest version of XCode along with the commandline tools. The thing to note here is with the OSX upgrade, the commandline tools of XCode is removed by the system. Even if, one installs the new XCode
, the commandline tools
are not included by default. All one has to do is install
it (again
).
Moving on, the next step is to upgrade the rvm. With the OSX upgrade, the normal rvm update does not work.
rvm get stable
So, the fix is to install rvm
(you can call it again
) as below.
\curl -sSL https://get.rvm.io | bash -s stable
Once this step is done everything else is just normal Ruby update thing. Update Ruby with the commad as below.
rvm install ruby-2.1.1
Now lets install a gem such as json, which can be done with the command as follows. I was suggesting sudo gem install json, but never do that. Instead use
gem install json
It seems using sudo
is not advisable
to be used while using rvm. I got a reply in twitter for this blog post, from @rvm_io as
looks good, the only hint - never use sudo with RVM, sudo “disables” RVM controlled ruby, the gem most likely is installed in system
Thats all to it. The important thing is, if we try to install the 2.x version of Ruby with old rvm, it will not work. Actually, it does not show even in the known list of Ruby.
Happy upgrading.