ruby版本和gem的ruby版本不匹配

时间:2010-09-19 19:59:16

标签: ruby macos rubygems

RubyGems报告的ruby版本与运行ruby --version不同。寻找有关诊断和解决此问题的建议。操作系统是OS X 10.5。

lando-macbook:rubygems-1.3.7 lando$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-9
  - GEM PATHS:
     - /Library/Ruby/Gems/1.8
     - /Users/lkuhn/.gem/ruby/1.8
     - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

lando-macbook:rubygems-1.3.7 lando$ ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin9]

lando-macbook:rubygems-1.3.7 lando$ which ruby
/opt/local/bin/ruby

1 个答案:

答案 0 :(得分:0)

问题是你在/ opt / local / bin中有一个ruby可执行文件,可能在某些时候由macports安装。删除此ruby可执行文件或从PATH变量中删除/ opt / local / bin应该可以解决您的问题。 gems正在告诉你它找到ruby及其相关可执行文件的确切位置:

RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin