问题
Always the same error:
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 `'
I guess something wrong with my ruby. But i don't know how to fix it
My environment:
MacOS 10.10.5 Xcode 7.2
Thanks in advance
回答1:
The system ruby installation seems to be messed up. Try removing the offending /Library/Ruby/Site/2.0.0/rubygems.rb
(and may be more of enclosing folders)
Ruby have its bundled rubygems at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0
so it should work with these.
Once ruby is alive - you can try upgrading rubygems again by sudo gem update --system
if needed, but I advise setting up a ruby version manager like rvm
(rvm.io) and leave the system ruby be there only for emergences and backing the brew
.
来源:https://stackoverflow.com/questions/35240324/something-wrong-with-my-ruby