This is done by using a gem called pik.
Step 1: install a gem by issuing fallowing command
in command prompt
>gem install pik
...
Successfully installed pik-0.3.0
1 gem installed
Step 2: after
successful installation of gem, you can use the
‘pik_install’ script to install the pik executable. Install pik to a location
that’s in your path, but someplace other than your rubybin dir. For instance,
the directory C:bin is in my path:
>path
PATH=c:\bin;C:\Program Files\Windows
Resource Kits\Tools\;c:\ruby\Ruby-186-p383\bin;
So i run,
>pik_install C:\bin
Thank you for using pik.
Installing to C:\bin
...
pik is installed
Simply type the command pik on command prompt, then
the current ruby version is added as default ruby of u r system.
>pik
U can add another ruby version by using fallowing
commands:
.....
$ pik install ruby 1.9.2
** Adding: 192: ruby 1.9.2 (2011-06-30 patchlevel 352) [i386-mingw32]
Now we can check current installed versions by fallowing command:
> pik list
*187: ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
192: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
the *
before 187 means that we are using Ruby 1.8.7 at this moment, let’s switch to
Ruby 1.9.2
> pik use 192
If you
run one last command you will see what happened
> ruby -v
ruby 1.9.2 (2011-06-30 patchlevel 352) [i386-mingw32]