Pik and Git Bash on Windows 7

Lately I’ve been installing Ruby on Rails on Windows 7, and have run into a few people trying to make my life easier. One is Sarah Mei, a wonderful member of devchix who has posted a guide for getting things running.  Hearts and bunnies and flowers for her.

Pik is a neat project for Windows that helps you switch between installed versions of ruby. I’m using the Git Bash shell (as mentioned in the guide above), so I had to do a bit of tweaking, and maybe you do too, so here goes:

For some reason the installer didn’t create my .pik/.pikrc file in my home directory, so if yours didn’t create either, this is how it should look:

#!/bin/sh
pik_path=C:\\pik

function pik {
$pik_path/pik_runner.exe pik.sh $@
[[ -s $USERPROFILE/.pik/pik.sh ]] && source $USERPROFILE/.pik/pik.sh
unset GEM_HOME
unset GEM_PATH
}

Those last two lines within the pik function are because something isn’t working in the current version and the gems aren’t being loaded when you switch versions.

Once you have your .pikrc add this line to your .bash_profile (create one if you don’t have it in your home directory):

[[ -s $USERPROFILE/.pik/.pikrc ]] && source $USERPROFILE/.pik/.pikrc

Hooray!

4 Comments

  1. Paul

    Do you have any idea why I would now be getting ‘bundle: command not found’ since adding pik and .bash_profile ? – Pik list and pik use seem to work, but now bundle is not found – i have a feeling this is due to the .bash_profile file i added, have you got any ideas please?
    thanks
    Paul

Leave a Reply

Your email address will not be published. Required fields are marked *