3

Configuring a new machine (Mac OS Mojave - Version 10.14.2).

After installing ruby with rbenv. I'm trying to install some gem and running :

gem install rake bundler rspec rubocop pry pry-byebug hub colored octoki

But its give me the following error :

ERROR:  While executing gem ... (TypeError)
    incompatible marshal file format (can't be read)
    format version 4.8 required; 60.33 given

Here is my Gem env :

RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.6
  - RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-darwin18]
  - INSTALLATION DIRECTORY: /Users/elise/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
  - USER INSTALLATION DIRECTORY: /Users/elise/.gem/ruby/2.5.0
  - RUBY EXECUTABLE: /Users/elise/.rbenv/versions/2.5.3/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/elise/.rbenv/versions/2.5.3/bin
  - SPEC CACHE DIRECTORY: /Users/elise/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/elise/.rbenv/versions/2.5.3/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-18
  - GEM PATHS:
     - /Users/elise/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
     - /Users/elise/.gem/ruby/2.5.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org/", "http://gems.github.com"]
     - :benchmark => false
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.github.com
  - SHELL PATH:
     - /Users/elise/.rbenv/versions/2.5.3/bin
     - /usr/local/Cellar/rbenv/1.1.1/libexec
     - ./bin
     - ./node_modules/.bin
     - /Users/elise/.rbenv/shims
     - /Users/elise/.rbenv/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/sbin

Does anyone know where this bug comes from? Thanks for the help.

  • 1
    See if this helps. (https://stackoverflow.com/a/54787462/9911698). Let me know if it does! – Gabriel Feb 21 '19 at 17:25
  • Would you install gems one by one and share the result? – zeitnot Feb 21 '19 at 17:34
  • 1
    Can you identify which gem this is failing on? `octoki` doesn't exist in rubygems, so it might be a misspelling. – Jay Dorsey Feb 21 '19 at 17:43
  • 2
    Characters 60,33 represent `<!` which means one of those downloads failed and instead of a marshal file you got an HTML or XML document of some sort. – tadman Feb 21 '19 at 19:07
  • @JayDorsey thats true it was "octokit" I made a mistake in my copy paste on Stackoverflow. I tried to run `gem install bundler` and `gem install rake` it doesn't worked too. I changed the gem source and it works fine now. Thanks :) – Elise Serres Feb 22 '19 at 08:51

2 Answers2

2

You have only enable very old (and not maintained) remote gem sources in your gem configuration. This might be caused by some old migrated configuration or by following some very old and outdated advice.

To fix this, you first need to remove the outdated gem sources and then add the only one which should be currently used. For that, you can run the following command from your Terminal:

gem sources --remove http://gems.github.com/
gem sources --remove http://gems.rubyforge.org/

gem sources --add https://rubygems.org/
Holger Just
  • 52,918
  • 14
  • 115
  • 123
1

You have to remove all the gem sources you have and add https://rubygems.org/ instead. Note that http://gems.rubyforge.org/ and http://gems.github.com are permanently dead and should be removed. You can list your sources by running:

gem sources 

You should get something like this:

*** CURRENT SOURCES ***

//gems.rubyforge.org/
//gems.github.com

1) Delete all sources:

gem sources -r http://gems.rubyforge.org/
gem sources -r http://gems.github.com

2) Add the right source:

gem sources -a https://rubygems.org/

Also, never sudo gem install

Hope this helps!

tavoyne
  • 5,591
  • 2
  • 14
  • 24