问题
I have a Mac Os running Snow Leopard 10.6.5 and I am trying to upgrade my Ruby installation.
Before I did anything, I run the following commands and I had the following results:
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
$ which ruby
/usr/bin/ruby
So, to upgrade my installation, I installed first macports and then Ruby using Ruby Version Manager (RVM).
1. bash < <(curl http://rvm.beginrescueend.com/releases/rvm-install-head)
2. mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone --depth 1 git://github.com/wayneeseguin/rvm.git && cd rvm && ./install
3. rvm install 1.9.2
4. rvm 1.9.2 --default
After that, I run the following commands and I had the following results:
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
$ which ruby
/usr/bin/ruby
$ rvm list
=> ruby-1.9.2-p136 [ x86_64 ]
Why Ruby is still at 1.8.7? What is wrong? Or, what I forgot?
回答1:
SOLVED:
Edit the '.profile' file in home directory:
Add the line at the bottom:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
and then in the Terminal run
source ~/.profile
to set the changes.
回答2:
Did you follow the "Post Install" instructions in the RVM installation page and add the following line to one of your ~/.bashrc, ~/.bash_profile or ~/.profile files?
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
That's really important to get RVM working correctly.
来源:https://stackoverflow.com/questions/4540446/upgrading-ruby-installation-on-mac-os-running-snow-leopard-10-6-5