I had some fun to use Ruby Version Manager Pik in Windows 7 today.
This is some little back and forth process with multiple attempts and troubleshoots to make it work eventually in Windows 7.
Here are some useful resource I read through and followed step by step:
By following the above resource, I installed the Pik easily as following screenshot.
The first problem I have is that I could not get pik command to be recognized by Git Bash.
Here is the screenshot:
Based on above screenshot, it told me to fix system path and add line to .bashrc file to make pik command recognizable. It is easy to fix system variable; but .bashrc, which is not a file in Windows, gave me some troublesome time. I did not copy exactly “[[ -s $USERPROFILE/.pik/.pikrc ]] && source $USERPROFILE/.pik/.pikrc” but I used absolute path so my code is “[[ -s G:/Users/Administrator/.pik/.pikrc ]] && source G:Users/Administrator/.pik/.pikrc“. This resolved the problem of not getting .pikrc file located when I open up Git Bash. However, I was keeping getting error like “/gbin/pik_runner.exe: No such file or directory“. After some reading, I found such error is defined in “G:Users/Administrator/.pik/.pikrc” which is sourced with Git Bash start-up as following screenshot.
I opened the .pikrc file and found that “pik_path=/gbin“; however it should be “pik_path=/g/bin“. There is a slash missing when making such file during the pik installation. With the correction of pik path location, I restarted Git Bash, and finally had pik command up and running as following screenshot.
You can try to see a list of command that Pik supports as following screenshot.
The rest is easy, I can install other version of Ruby Windows Installer easily by using their standalone installation file; but make sure, do not check the option to write the installation bin folder into system path. We use pik to handle the Ruby version switch magic as following.
As above screenshot shown, I can add a new version of Ruby installed; and I can list multiple versions of Ruby in current system; and then I can choose the one I want to use for current implementation.
I strongly recommend that anyone who has trouble installing the pik and understanding pik usage, please follow the above linked resource.
Cheers and Happy Web Development.