error with rubygems – marshal data too short

This was a strange thing. I had installed the rubygems by hand using the tar.gz from I use version 1.3.1 currently. It worked fine at first, so I installed all the gems I needed, like rails etc.

When I wanted to install some more gems today, all I got to see was:

# gem update
updating installed gems
ERROR: ย While executing gem … (ArgumentError)
  marshal data too short

And this error kept popping up – no matter what commands I wanted to run with rubygems (update, update –system, install…)

I searched for a solution on google and found forums for ruby etc. Unfortunately none of these posts offered a solution to the problem – at least none, that was specific to my situation. It seems as though, this problem (mashal data too short) can occur in a lot of places, especially in databases and such. Must a an index of some kind.

Anyway, my fix was to delete everything in the ~/.gems diretory. That sets back your entire install of rubygems, because this holds information on what gems are installed an so on. But afterwards at least the “gem” command worked again. ๐Ÿ˜‰

I just reinstalled all my gems. You can get a list of all installed gems with

gem list –local

This command actually worked before – thank god. ๐Ÿ˜‰

All right – so much for now. Just a short incident-report. ๐Ÿ˜‰