Thursday, March 31, 2011

Steps to install pik, add ruby to pik list and switch between Ruby version

I use Pik to manage multiple versions of ruby on a Windows machine. Here are the steps to install pik:

Install the pik gem
> gem install pik
......
Successfully installed pik-0.2.8
1 gem installed

Then check path
>path
PATH=C:\Program Files\ImageMagick-6.6.4-Q16;C:\Program Files\ImageMagick-6.5.6-Q8;C:\Windows\system32;C:\Program Files\Git\bin;C:\Program Files\Git\cmd; C:\Ruby187\bin

Then Install pik to a location other than your ruby\bin dir. I used C:\pik

>pik_install C:\pik
Thank you for using pik.
Installing to C:\pik
...
pik is installed

It will install pik and will create a folder 'pik' in C:\ drive. You will get 'C:\pik'
Now add the variable 'C:\pik' in your 'Environmental Variables' path.

For steps to add path in 'Environmental Variables' or troubleshooting the setup of 'Environmental Variables', please see post "setting-path-cpik-in-environmental-variable"

Download Ruby 1.9.2 exe from http://rubyforge.org/frs/download.php/74298/rubyinstaller-1.9.2-p180.exe
Install and add the new Ruby version to pik registry.

>pik add C:\Ruby192\bin

You can check the List of all available Ruby versions added in pik, one with the '*' sign displays the default one:

>pik list
* 187: ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
   192: ruby 1.9.2p180 (2011-02-18) [i386-mingw32]


>ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]


To switch to Ruby 1.9.2:

>pik 192
>pik list
   187: ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
* 192: ruby 1.9.2p180 (2011-02-18) [i386-mingw32]



>ruby -v
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

To switch back to Ruby 1.8.7:
>pik 187

Its over and pik is successfully installed, now you know how to install pik, add ruby to pik list and switch between Ruby version

2 comments:

  1. I'm a super user admin on windows 7 and I have no access to path system variables, how do I fix this without creating another account?

    ReplyDelete
  2. Hi ,

    i have a small problem. I am using Ruby version 1.8.7 and 1.9.3 , i installed 1.8.7 and executed a ruby script, it worked. Then i installed 1.9.3 configured everything successfully. The versions are switching and also the gem list is different. But when i switch back to 1.8.3 , and exec the old script, it still uses the Ruby193 lib against the Ruby187 lib. Is there a fix or work around for this?

    ReplyDelete