views:

286

answers:

3

Getting a 'marshal data too short' error when trying to install the mysql gem on OSX. Poking around I've heard suggestions to clear out .gems, but can't seem to locate it on the system. Can anyone offer help?

apple$ sudo gem install mysql --backtrace --debug
Exception `NameError' at /Library/Ruby/Site/1.8/rubygems/command_manager.rb:161 - uninitialized constant Gem::Commands::InstallCommand
Exception `Gem::LoadError' at /Library/Ruby/Site/1.8/rubygems.rb:826 - Could not find RubyGem test-unit (>= 0)

Exception `ArgumentError' at /Library/Ruby/Site/1.8/rubygems/spec_fetcher.rb:111 - marshal data too short
ERROR:  While executing gem ... (ArgumentError)
    marshal data too short
    /Library/Ruby/Site/1.8/rubygems/spec_fetcher.rb:111:in `load'
    /Library/Ruby/Site/1.8/rubygems/spec_fetcher.rb:111:in `fetch_spec'
    /Library/Ruby/Site/1.8/rubygems/spec_fetcher.rb:71:in `fetch'
    /Library/Ruby/Site/1.8/rubygems/spec_fetcher.rb:70:in `map'
    /Library/Ruby/Site/1.8/rubygems/spec_fetcher.rb:70:in `fetch'
    /Library/Ruby/Site/1.8/rubygems/dependency_installer.rb:99:in `find_gems_with_sources'
    /Library/Ruby/Site/1.8/rubygems/dependency_installer.rb:192:in `find_spec_by_name_and_version'
    /Library/Ruby/Site/1.8/rubygems/dependency_installer.rb:213:in `install'
    /Library/Ruby/Site/1.8/rubygems/commands/install_command.rb:118:in `execute'
    /Library/Ruby/Site/1.8/rubygems/commands/install_command.rb:115:in `each'
    /Library/Ruby/Site/1.8/rubygems/commands/install_command.rb:115:in `execute'
    /Library/Ruby/Site/1.8/rubygems/command.rb:257:in `invoke'
    /Library/Ruby/Site/1.8/rubygems/command_manager.rb:132:in `process_args'
    /Library/Ruby/Site/1.8/rubygems/command_manager.rb:102:in `run'
    /Library/Ruby/Site/1.8/rubygems/gem_runner.rb:58:in `run'
    /usr/bin/gem:21
A: 

Try using the below command . Provide the location of the mysql directory in your OS X .

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

http://hivelogic.com/articles/installing-mysql-on-mac-os-x/

Check the link for installing Mysql on Mac OSX if you haven't correctly installed .

Good luck !

YetAnotherCoder
A: 

Also, the .gem directory is located in your home directory: /Users/yourname/.gem

Hope that helps.

Gav
+1  A: 

I got the same error on my windows machine, If I would use gem.

ERROR:  While executing gem ... (ArgumentError)    
marshal data too short

To delete the gem cache directory "c:\Documents and Settings\MyUser\.gem" worked for me. It seems that some data are saved even if you reinstall ruby. Probably a cached file was corrupted.

tivo