0

Whenever I type in a gem command I get the following error:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 3 column 1 (Psych::SyntaxError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:129:in `load'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:319:in `load_file'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/config_file.rb:192:in `initialize'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `new'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `do_configuration'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/gem_runner.rb:46:in `run'
from /usr/bin/gem:21:in `<main>'

I've checked other threads and it seems to be a parsing issue but, in my case, I can't pinpoint where the parsing error is occurring. I can't even type 'gem -v' without getting the error. I'm a newb with Terminal, so please keep that in mind when offering solutions.Thanks!!

wheresmyspaceship
  • 870
  • 2
  • 12
  • 19
  • I would try [reinstalling rubygems](http://stackoverflow.com/questions/13974160/reinstalling-rubygems), and you might also want to try out [RVM](http://rvm.io/) – max Sep 28 '14 at 20:26
  • What is happening is that psych which is YAML parser is encountering a syntax error. It could also be that you have a bad `.gemrc` file in your home folder (`cd ~`) – max Sep 28 '14 at 20:30
  • @papirtiger I was actually in the process of installing RVM when I encountered this problem. Came across it when trying to use gem to install rails via terminal command: 'gem install rails". Reinstalling rubygems gives me the same error message. In the case of a bad .gemrc file, can I re-download it from somewhere or should I just delete it altogether? – wheresmyspaceship Sep 28 '14 at 23:10
  • `.gemrc` is just user preferences so it should be safe to delete. – max Sep 28 '14 at 23:12
  • Thank you @papirtiger! Deleting .gemrc has fixed the problem. – wheresmyspaceship Sep 28 '14 at 23:29

1 Answers1

0

What is happening is that Psych which is a YAML parser is encountering a syntax error. It could be that you have a bad .gemrc file in your home folder (cd ~)

max
  • 96,212
  • 14
  • 104
  • 165