我的红宝石出了点问题

时间:2016-02-06 11:13:08

标签: ruby macos rubygems yosemite

总是一样的错误:


AilixdeMacBook-Pro:~ Ailix$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
AilixdeMacBook-Pro:~ Ailix$ ruby -d
Exception `LoadError' at /Library/Ruby/Site/2.0.0/rubygems.rb:1240 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Library/Ruby/Site/2.0.0/rubygems.rb:1249 - cannot load such file -- rubygems/defaults/ruby
Exception `NameError' at /Library/Ruby/Site/2.0.0/rubygems.rb:1257 - uninitialized constant Gem::Specification
/Library/Ruby/Site/2.0.0/rubygems.rb:1257:in `': uninitialized constant Gem::Specification (NameError)
    from :1:in `require'
    from :1:in `'
AilixdeMacBook-Pro:~ Ailix$ gem -v
/Library/Ruby/Site/2.0.0/rubygems.rb:1257:in `': uninitialized constant Gem::Specification (NameError)
    from :1:in `require'
    from :1:in `'
AilixdeMacBook-Pro:~ Ailix$ brew -v
/Library/Ruby/Site/2.0.0/rubygems.rb:1257:in `': uninitialized constant Gem::Specification (NameError)
    from :1:in `require'
    from :1:in `'
AilixdeMacBook-Pro:~ Ailix$ pod repo
/Library/Ruby/Site/2.0.0/rubygems.rb:1257:in `': uninitialized constant Gem::Specification (NameError)
    from :1:in `require'
    from :1:in `'

我猜我的红宝石有问题。但我不知道如何解决它

我的环境:

MacOS 10.10.5
Xcode 7.2

提前致谢

1 个答案:

答案 0 :(得分:2)

系统ruby安装似乎搞砸了。尝试删除有问题的/Library/Ruby/Site/2.0.0/rubygems.rb(可能更多是封闭文件夹)

Ruby在/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0拥有捆绑的rubygems,所以它应该可以使用这些。

一旦ruby还活着 - 如果需要,你可以尝试sudo gem update --system再次升级rubygems,但是我建议设置像rvm(rvm.io)这样的ruby版本管理器并让系统ruby在那里仅用于出现和支持brew