Enable a per-project RVM configuration file

This feature allows developers to define project-specific settings such as the Ruby version and dems to use. Those settings will be loaded when entering the project directory.

To enable this feature, follow these steps:

  • Edit the file installdir/rvm/.rvmrc and change the property rvm_project_rvmrc=0 to rvm_project_rvmrc=1. The result will be similar to the output below:

    export rvm_project_rvmrc=1
    export rvm_bin_path="/home/bitrock/rubystack-3.2.3-0/rvm/bin"
    export rvm_usr_path="/home/bitrock/rubystack-3.2.3-0/common"
    export rvm_patch_names="osx-arch-fix"
    export rvm_path="/home/bitrock/rubystack-3.2.3-0/rvm"
    export rvm_prefix="/home/bitrock/rubystack-3.2.3-0"

    After enabling this feature, when entering a directory containing an .rvmrc file, you will receive a warning message asking for permissions to use the .rvmrc file:

    = NOTICE                                                                           =
    = RVM has encountered a new or modified .rvmrc file in the current directory       =
    = This is a shell script and therefore may contain any shell commands.             =
    =                                                                                  =
    = Examine the contents of this file carefully to be sure the contents are          =
    = safe before trusting it! ( Choose v[iew] below to view the contents )            =
    Do you wish to trust this .rvmrc file? (/home/bitrock/rubystack-3.2.3-0/rvm/.rvmrc)
    y[es], n[o], v[iew], c[ancel]>

    If you know the contents of the file and that it is safe, accept. You will receive this message every time a new .rvmrc file is found or when a known .rvmrc file changes.

  • Change into the project directory and use rvm to create the sample .rvmrc file. For example, if you want to use Ruby 1.9.3 with the gemset bitrock-sample, use thse commands:

    $ cd /home/bitrock/projects/rubystack-3.2.3-0
    $ rvm --rvmrc --create 1.9.3@bitrock-sample
  • Leave and re-enter the directory. You will be prompted as above and the configured environment will be loaded. To manually trust the new .rvmrc file, execute this command:

    $ rvm rvmrc trust