Skip to content
VersionSwither is a small utility to switch version of Ruby/Python/PHP/Node.js/...
Python Shell CSS
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Copyright: copyright(c) 2011 all rights reserved
License:Public Domain

About VersionSwitcher

VersionSwitcher is a small utility to switch version of programming language or application. Switching mechanism is just modiying $PATH environment variable, therefore it doesn't depend on a certain programming language or application.


  • Switch language version by modifying $PATH environment variable.
  • Supports any programming languages such as Ruby, Python, Node.js, and so on (you don't have to change switcher tool for each language).

Currently it only supports bash and zsh on Unix-like system or Mac OS X.


[bash]$ VS_HOME=$HOME/lang
[bash]$ vs python 2.6.6   # use $HOME/lang/python/2.6.6
[bash]$ vs python 2       # use $HOME/lang/python/2.x.x (ex. 2.7.1)
[bash]$ vs python latest  # use latest version under $HOME/lang/python
[bash]$ vs python -       # use system-installed one (ex. /usr/bin/python)
[bash]$ vs python         # show installed versions of python
[bash]$ vs                # show all languages installed

Install VersionSwitcher


  1. Download ''.
  2. Start it with bash (for bash user) or zsh (for zsh user).
  3. Log out or restart bash or zsh to enable settings.


[bash]$ wget
[bash]$ bash    # or zsh if you are a zsh user
*** You have to write the following lines into your ~/.bashrc:
***     VS_HOME=$HOME/langs     # or other directories
***     . $HOME/.vs/
*** Do you want to add above lines into your ~/.bashrc? [Y/n]: y
*** You should log out or restart bash to enable settings.
*** Installation is finished successfully.
*** See for details.
*** Thank you.
[bash]$ bash       # start new bash process
[bash]$ vs -h      # show help

Install Languages

All languages which you want to switch should be installed into $HOME/lang (or other directory where you specified by $VS_HOME) such as:

+ $HOME/
  + lang/
    + ruby/
      + 1.8.7-p334/
        + bin/
          - ruby
      + 1.9.2-p180/
        + bin/
          - ruby
    + python/
      + 2.6.6/
        + bin/
          - python
      + 2.7.1/
        + bin/
          - python
      + 3.2.0/
        + bin/
          - python
    + node/
      + 0.4.7/
        + bin/
          - node

VersionSwitcher supports ANY programming languages to switch as long as they are installed according to the above structure.

In addition, VersionSwitcher has a feature to install the following languages easily:

* Node.js (
* Python (
* PyPy (
* Ruby (
* Rubinius (
* Lua (
* LuaJIT (

The following is an exaple to install Node.js (and npm command):

[bash]$ vs -i                # or vs --install
## try 'vs -i LANG' where LANG is one of:
lua         #
luajit      #
node        #
pypy        #
python      #
rubinius    #
ruby        #
[bash]$ vs -i node
## try 'vs -i node VERSION' where VERSION is one of:
[bash]$ vs -i node latest    # or vs -i node 0.4.7
** latest version is 0.4.7
** Install into '/home/yourname/lang/node/0.4.7'. OK? [Y/n]:
** Configure is './configure --prefix=/home/yourname/lang/node/0.4.7'. OK? [Y/n]:
$ wget -nc
$ tar xzf node-v0.4.7.tar.gz
$ cd node-v0.4.7/
$ time ./configure --prefix=/home/yourname/lang/node/0.4.7
$ time JOBS=2 make
$ cd ..
$ hash -r
$ which node

** Install npm (Node Package Manger)? [Y/n]:
$ wget -qO - | sh
! [ -d .git ] || git submodule update --init
node cli.js cache clean
** npm installed successfully.

** Installation is finished successfully.
**   language:  node
**   version:   0.4.7
**   directory: /home/yourname/lang/node/0.4.7

** vs node 0.4.7
$ export PATH=/home/yourname/lang/node/0.4.7/bin:/usr/local/bin:/usr/bin:/bin
$ noderoot='/home/yourname/lang/node/0.4.7'
$ nodeversion='0.4.7'
$ which node

The above steps are same for other languages such as ruby, python, lua and luajit.


  • It is allowed to set VS_HOME=path1:path2:path3:...

  • VersionSwitcher sets $xxxroot and $xxxversion shell variables. For example, if you execute 'vs ruby 1.9', $rubyroot and $rubyversion shell variables will be set.

  • $HOME/.vs/hooks/<language>.sh is imported if exists. For example:

    ## $HOME/.vs/hooks/
    if [ -n "$rubyroot" ]; then
        ## set prompt to show ruby version
        PS1="ruby@$rubyversion> "
        ## clear prompt
        PS1="> "


Release 0.6.0 (2012-02-20)

  • Change to rename environment variable '$VS_PATH' to '$VS_HOME'.
  • Enhance '-i' option to add '*' after version number installed.
  • Enhance to add 'misc/python.profile' which can be alternative of Python's virtualenv.
  • Enhance 'hooks/' to consider 'misc/python.profile'.
  • Change not to execute 'which' command when switching language version.
  • Change '-U' (self upgrade) option to '-u'.
  • Change '-u' (self upgrade) to confirm when overwriting existing hook scripts.
  • Fix bugs which happened on zsh.
  • Fix configure command of Perl installer script.
  • Update RubyGems version installed to 1.8.17.
  • Change Rubinius installer to check whether g++ and rake are installed.

Release 0.5.0 (2011-11-29)

  • Enhance '-i' option to access to download page of each language in order to get installable versions.
  • Enhance to add '-U' option for self-upgrade.
  • Enhance to suppoert Perl installer.
  • Enhance to suppoert Gauche installer.
  • Change output format of '-i' option when showing versions.
  • Change installer scripts to prefer 'curl' rather than 'wget'.
  • Change installer scripts to invoke 'make' command with 'nice -10'.
  • Document updated.

Release 0.4.1 (2011-11-28)

  • Fix Ruby installer to install Rubygems correctly.
  • Update Rubygems version installed to 1.8.11.

Release 0.4.0 (2011-11-25)

  • Follow new download url of PyPy.

Release 0.3.3 (2011-11-24)

  • Fix 'ruby' installer to install on Ruby 1.8.5 or older.

Release 0.3.2 (2011-11-21)

  • Fix 'node' installer to follow change of Node download page.

Release 0.3.1 (2011-05-18)

  • Fix 'ruby' installer to remove duplicated '.tar' extension.
  • Fix '' to report error when download by wget is failed.

Release 0.3.0 (2011-05-08)

  • Enhance to provide '' to make installation easy.
  • Enhance to provide '' to import lazily.
  • Enhance to add PyPy and Rubinius as installable languages.

Release 0.2.0 (2011-05-01)

  • Enhance to support '-i' option to install languages.
  • Changed to sort version number correctly when detecting latest version.
  • Document updated.

Release 0.1.1 (2011-04-28)

  • Fix a typo.

Release 0.1.0 (2011-04-27)

  • Public release
Something went wrong with that request. Please try again.