[英]I want to use ruby1.9.3 in my Mac, but it still using ruby1.8.7 after I installed the ruby1.9.3
As you know, Ruby is pre-installed in Mac and it's version is 1.8.7 如您所知,Ruby已预装在Mac中,版本为1.8.7。
[zhuhuihuihui@akematoMac-mini ~] $ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
For some reasons, i need to use Ruby-1.9.3 instead. 由于某些原因,我需要改用Ruby-1.9.3。
Basically, i followed these steps: 基本上,我遵循以下步骤:
brew update
brew install rbenv
brew install ruby-build
rbenv install 1.9.3-p0
rbenv rehash
Everything works fine, but i still getting the same version(1.8.7) after i installed the 1.9.3 I can use ruby-1.9.3 only if i typed the full path, like this: 一切正常,但是在安装1.9.3之后,我仍然得到相同的版本(1.8.7),只有键入完整路径,我才能使用ruby-1.9.3,如下所示:
[zhuhuihuihui@akematoMac-mini ~] $ ~/.rbenv/versions/1.9.3-p0/bin/ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin12.4.0]
But my system is still using Ruby-1.8.7. 但是我的系统仍在使用Ruby-1.8.7。
Any help will be appreciated. 任何帮助将不胜感激。
I haven't tried installing rbenv with brew, but have you done this part? 我没有尝试通过brew安装rbenv,但是您完成了这部分吗?
From: https://github.com/sstephenson/rbenv 来自: https : //github.com/sstephenson/rbenv
Afterwards you'll still need to add eval "$(rbenv init -)" to your profile as stated in the caveats. 之后,您仍然需要按照注意事项所述,将eval“ $(rbenv init-)”添加到您的个人资料中。 You'll only ever have to do this once. 您只需要执行一次。
This maybe has to do with your $PATH
. 这可能与您的$PATH
。 Have you edited your .bash_profile
to prepend the rbenv's path? 您是否已编辑.bash_profile
来添加rbenv的路径?
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
Basically, I recommend you to make sure you've done steps 2-6 from the instructions: https://github.com/sstephenson/rbenv#installation 基本上,我建议您确保已按照说明完成步骤2-6: https : //github.com/sstephenson/rbenv#installation
Yes, after i typed 是的,我输入后
eval "$(rbenv init -)"
in my terminal, It works. 在我的终端上,它有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.