rbenv is a ruby version manager. It allows you switch between different versions of ruby.
rbenv installs the “shims” directory to your path. rehashing updates the shims in that directory to match every ruby command across every installed version of ruby. e.g. irb, gem, rake, rails, ruby.
Each shim will pass the command along to rbenv.
When the shim passes execution to rbenv, rbenv will look for the appropriate version or ruby to execute the command.
- RBENV_VERSION environment variable
- .ruby-version file in current directory, then recurse up to the top of the file system.
To rebuild the shims for each version of ruby you can use the rehash command.
You should do this whenever you install a new ruby or a gem with a command in the bin directory.
rbenv does not install different versions of ruby. It allows you to choose how you want to install the different rubies on your system. rbenv does provide a plugin system to allow third party plugins to interact with rbenv. the ruby-build plugin is an extension that will install different versions of ruby using the familiar install syntax.
Each version of ruby is installed in ~/.rbenv/versions/. If you want to install ruby yourself you just have to create a symlink from the versions directory to wherever you installed ruby.
The rbenv init command will install ~/.rbenv/shims to your PATH environment variable. It also sources ~/.rbenv/completions/rbenv.bash for autocompletion.
rbenv is a light weight unix friendly tool for managing your different rubyies.