How do I upgrade my ruby 1.9.2-p0 to the latest patch level using rvm?

前端 未结 8 1821
庸人自扰
庸人自扰 2021-01-29 18:25

My current version of ruby is ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0] but I want to update it to the latest patch level using rvm. How can I

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-29 19:00

    npad's answer definitely lays out the basics so I won't reiterate those steps, but there are several answers here suggesting using rvm upgrade. I know that rvm gives you the option, but it's a bit of a dangerous one.

    IMO, the safer and more "rvm way" is to first rvm install the new ruby version, then use the rvm gemset copy command to copy your gemset(s) to the new ruby version, e.g. rvm gemset copy 1.9.2-p0@some-gemset 1.9.2-p290@some-gemset. Then you can easily switch your project to using the newly-copied gemset (I recommend using an .rvmrc file in your project directory) and see if your code fails. If it does, changing back to the old ruby version is just a matter of switching the gemset.

    But even if you don't use gemsets (though I assume you do since you tagged rails on this question), the use of rvm upgrade can lead to unexpected failures. And if your code breaks, now you have to reinstall the old version again. Just take a bit more time and do it the clean way.

提交回复
热议问题