简体   繁体   English

我想在Mac中使用ruby1.9.3,但在安装ruby1.9.3之后仍使用ruby1.8.7

[英]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.

相关问题 是否可以将ruby-debug-ide与ruby1.9.3一起安装在Windows上? - Is ruby-debug-ide available to be installed on windows with ruby1.9.3? 如何将 SameSite 属性设置为“无”; 在 Rails3.1.12 和 Ruby1.9.3 中安全 - How to set SameSite attribute to 'None; Secure' in Rails3.1.12 and Ruby1.9.3 我如何使Ruby 1.9.3应用适应在使用Ruby 1.8.7的服务器上工作 - How do I adapt a Ruby 1.9.3 app to work on a Server using Ruby 1.8.7 安装了ruby 2.1.1,rails正在使用1.9.3 - Installed ruby 2.1.1, rails is using 1.9.3 为什么Heroku仍不使用我的Ruby 1.9.3版? - Why Heroku is still not using my Ruby version 1.9.3? 将Ruby 1.8.7升级到1.9.3加载错误 - upgrading ruby 1.8.7 to 1.9.3 load error 将rails app从1.8.7升级到ruby 1.9.3 - upgrading rails app from 1.8.7 to ruby 1.9.3 Rails安装程序C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:353:in`kill':无效参数(Errno :: EINVAL) - Rails Installer C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:353:in `kill': Invalid argument (Errno::EINVAL) 寻找将Ruby 1.8.7 Web应用程序迁移到Ruby 1.9.3的步骤 - Looking For Steps In Migrating Ruby 1.8.7 Web Application To Ruby 1.9.3 我在Assert,Ruby 1.9.3上收到NoMethodError - I'm receiving NoMethodError on Assert, Ruby 1.9.3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM