i installed ruby 1.9.2 with RVM, but when i type “

2019-04-30 13:17发布

问题:

when i write in the treminal "rvm list" i get this:

rvm rubies

   ruby-1.9.1-p378 [ x86_64 ]
   ruby-1.9.2-p136 [ x86_64 ]

but when i type "ruby -v" i get this:

ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

what shoud i do?

回答1:

Have you tried rvm use 1.9.2? Installing rubies does not make them the executable version of ruby. RVM will only make ruby the 1.9.2 version if you tell it to, with rvm use 1.9.2 or rvm use 1.9.1

If you want rvm to use 1.9.2 by default, use rvm --default use 1.9.2



回答2:

Without actually looking at your system, I can't say for sure what is happening, but it would appear that you skipped the RVM Post Install step (see RVM Install page, which is what loads it into your shell session.

Quoting from the RVM Install page:

Post Install

The first time you install RVM, you must put the following line into your ~/.bash_profile at the very end, after all path loads etc:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && ."$HOME/.rvm/scripts/rvm"

This loads RVM into a shell session.

NOTE: If you are using zsh you likely instead should put the sourcing line into ~/.zshrc

Doing so ensures rvm is loaded as a function (versus as a binary), ensuring commands such as rvm use work as expected.

An additional point:

Ensure that rvm is the last thing sourced in all of your shell profiles - e.g. it is sourced in the user specific profile after any environment variables, especially PATH are set. Otherwise, the values you set be trampled when you switch rubies.



标签: ruby macos rvm