Recommend
If you like my work with RVM, please recommend me *with a comment as to why you recommend me* on
Working With Rails – Thank You!
IRC
I am 'wayneeseguin' in #rvm on irc.freenode.net
If I do not respond right away, leave a message and I'll respond or leave you a memo when I am around.
Sponsors
$ rvm help # Documentation Index

Hooks

RVM supports several hooks.

Each hook is a file in ~/.rvm/hooks/[hook name] in which you can place any sequence of bash scripting commands. Each hook file when run will have available to it the entire RVM environment. Some useful RVM environmental variables are:

For `after_use` and `after_cd` hooks, multiple hook files are processed. RVM provides the main hook file for each of these, which loads other files within the hooks directory that are prefixed with `[hook name]_`. Each prefixed hook file which has it's executable flag set will be loaded in alphabetical order.

Other hooks may follow this convention in the future, if necessary. When RVM is updated, any existing hook file that needs to be replaced with one of these wrappers will be renamed to `[hook name]_custom`.

As an example say we want to print out the ruby string every time we switch rubies.

$ cat > ~/.rvm/hooks/after_use_show_ruby <<EOF
>    echo "Now using \$rvm_ruby_string"
>  EOF
$ chmod +x ~/.rvm/hooks/after_use_show_ruby

Will produce the following.

$ rvm 1.9.1
  Now using ruby-1.9.1-p243

$ rvm 1.8.7
  Now using ruby-1.8.7-p174

Community Resources

RVM Documentation Index