Its true that there is no ruby version manager on windows, which makes life really difficult for a lot of ruby or rails developers I am sure, Well it did for me at least. A lot of applications developed in version 1.8.7 aren’t compatible with the new version. A lot of applications also fix themselves to use only specific versions of ruby, so there is not much we can do, unless you are a mega-geek and can change a lot of things and ofcourse have a lot of time. On linux we always have had RVM to solve this problem which lets us have different versions of ruby, different gemsets for each version of ruby, makes life really easy. But what for the windows developers? Thankfully a noble soul known as Gordon Thiesfeld made something amazing known as pik. which essentially works the same as Ruby version manager, with a few differences in installations but none in usage. Both of them are equally easy to use.
I am not going to write about how to install and use RVM, since there is enough help for that on the WWW. But Since I love windows users(I being one). We will have a walk-through with pik today. Before we start you can have a look at the github page of the project – https://github.com/vertiginous/pik
Installations –
It does mention that you need to install ruby 1.8.7 first to install pik, Now ruby 1.8.7 is an older version and I wonder, why would I need to install an older version to install a newer version, So first I went ahead and installed ruby 1.9.2-p290 from http://rubyinstaller.org/downloads/ for installing pik. Seems it worked just fine. You can choose to install ruby 1.8.7 first and then install pik, its entirely upto you.
After installing Ruby make sure, you also have devkit installed, if you are a windows user you would know that ofcourse, dev kit is used to build the gems that are developed with native extensions, which means nothing, but those gems are made partially in ruby and partially using c. You can’t miss C anywhere can you. Anyways, I will give a quick guide about installing devkit, since you are going to need it anyways.
Head over to http://rubyinstaller.org/downloads/ and download DevKit.
Installations steps
1. The file you downloaded is just an extractor, extract is to somewhere where you wont delete it by mistake.
2. After extraction, open up CMD and cd to the location where you extracted the files.
3. run
ruby dk.rb init
4. This will let you know the ruby installed in your system.
5. run
ruby dk.rb install
and you are done. Didn’t take too much time, did it?
Now we move on to pik installation steps
1. Fire up CMD and run
gem install pik
2. Now if you type
pik list
you will be able to see that it shows the base version of ruby that you installed. In my case, it shows
* 192: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
3. There are two ways of adding ruby versions to pik, either you install them manually and add to pik or you just install them through pik. We will see how to install them from pik, since we are going to use pik anyway, less bothersome to do it from pik, than downloading from the internet, installing each of them and then adding to pik.
4. Installing other version of ruby
pik install ruby 1.8.7
And here you go it will install the version of ruby and add that to pik by itself, Less of a hassle. right?
5. Check the versions of ruby installed in your system
pik list
6. Change the version of ruby that you want to use
pik use ruby [verions]
in my case
pik use ruby 1.8.7
7. Don’t forget to use the help if you get stuck.
pik help commands
Way cool! Some extremely valid points! I appreciate you writing this write-up plus the rest of the site is also very good.
LikeLike