I cannot get rvm to read my project specific .rvmr

2020-07-09 07:09发布

问题:

I come in peace (re: rbenv) but I am super frustrated with rvm & .rvmrc. I keep on running into issues where I cd into my project folder only to find that my ruby & gemset environment has not been set correctly. So can someone once and for all tell me how to create a proper .rvmrc for my project.

I have tried both ways that I know of:

  1. creating a .rvmrc and putting 'rvm use 1.9.2@GEMSET' in there (this works sometimes and sometimes not)
  2. using the rvm --create --rvmrc 1.9.2@GEMSET command line tool which creates a more ellaborate .rvmrc but cd'ing into my project folder is still not giving me the desired result.

This problem is erratic. I will say that I am working on two different machines and syncing my project folder via Dropbox. So could this be a problem where rvm cannot verify the folder and therefore ignores the .rvmrc?

Any help will be greatly appreciated.

回答1:

You may need to set

rvm_project_rvmrc=1

in your shell config before the rvm scripts are sourced, e.g.:

rvm_project_rvmrc=1
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"


回答2:

Every time you enter a project directory after changing its .rvmrc file, rvm will prompt you for accepting or not the new file. If you want to change your decision afterwards, you should use rvm rvmrc command:

rvm rvmrc {trust,untrust,trusted,load,reset}


标签: rvm