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.
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/
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!
Related
Title says it all, whenever I try to install a gem this happens :
ERROR: Could not find a valid gem 'ruby2d' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - timed out (https://api.rubygems.org/specs.4.8.gz)
I have reinstalled ruby to try to fix this, without any luck.
Also, I tried updating my rubygems version, getting this error :
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
timed out (https://api.rubygems.org/specs.4.8.gz)
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.6
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x64-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby25-x64/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: C:/Users/julia_ps3fg4w/.gem/ruby/2.5.0
- RUBY EXECUTABLE: C:/Ruby25-x64/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby25-x64/bin
- SPEC CACHE DIRECTORY: C:/Users/julia_ps3fg4w/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x64-mingw32
- GEM PATHS:
- C:/Ruby25-x64/lib/ruby/gems/2.5.0
- C:/Users/julia_ps3fg4w/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
It looks like you're missing sources in your gem configuration. Try this.
gem sources -a http://rubygems.org
It should edit your ~/.gemrc file to look like this:
---
:backtrace: false
:bulk_threshold: 1000
:sources:
- http://rubygems.org
:update_sources: true
:verbose: true
https://github.com/rubygems/rubygems/issues/2253
TL;DR: some ipv6 requests dont go through. use ipv4
I faced also the same problem on my Mac OS 13 Venture.
I changed my IpV6 configuration like this
Restarted my MAC.
Then gem install bundler
Environment:
Mac OS X 10.11.3 (El Capitan)
Homebrew 0.9.5
rvm 1.26.11 (same problem occurs with rbenv)
Bundler 1.11.2
Gemfile (excerpt):
source 'https://rubygems.org'
require 'bundler/bower'
asset "jquery", "~2.1.4"`
I get this error:
bundle install
[!] There was an error parsing `Gemfile`:
cannot load such file -- bundler/bower. Bundler cannot continue.
# from /Users/nobby/becompany/website/src/website-static/Gemfile:5
# -------------------------------------------
#
> require 'bundler/bower'
#
# -------------------------------------------
My RubyGems environment is:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/nobby/.rvm/gems/ruby-2.3.0
- USER INSTALLATION DIRECTORY: /Users/nobby/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/nobby/.rvm/rubies/ruby-2.3.0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/nobby/.rvm/gems/ruby-2.3.0/bin
- SPEC CACHE DIRECTORY: /Users/nobby/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/nobby/.rvm/rubies/ruby-2.3.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/nobby/.rvm/gems/ruby-2.3.0
- /Users/nobby/.rvm/gems/ruby-2.3.0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/nobby/.rvm/gems/ruby-2.3.0/bin
- /Users/nobby/.rvm/gems/ruby-2.3.0#global/bin
- /Users/nobby/.rvm/rubies/ruby-2.3.0/bin
- /Users/nobby/.rvm/bin
- /Users/nobby/src/apache/ant/apache-ant-1.9.6/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
Maybe bundler is looking in the wrong gem paths? Is there a way to see which paths it is using?
It works when I manually add the dependencies to LOAD_PATH in Gemfile; maybe this helps to point me to the cause of the problem:
[ 'bundler-bower-0.0.3', 'bower-rails-0.10.0'].each do |dep|
$LOAD_PATH.unshift "/Users/nobby/.rvm/gems/ruby-2.3.0/gems/#{dep}/lib"
end
https://github.com/LTe/bundler-bower
You need to
gem install 'bundler-bower'
before you can require modules from it. Potentially (hopefully) bundler is clever enough to resolve dependency order if you add
gem 'bundler-bower'
to your gemfile and then install it with
bundle install
instead
My OS X ruby dev environment is broken, I don't know why.
I undesrtood that the gem path is wrong, but I don't know how to fix it.
/Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'rails' (>= 0) among 14 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/muqaddar/.rvm/gems/ruby-2.0.0-p598:/Users/muqaddar/.rvm/gems/ruby-2.0.0-p598#global', execute `gem env` for more information
from /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/bin/rails:22:in `<main>'
Here is my config with gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.6
- RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x86_64-darwin14.1.0]
- INSTALLATION DIRECTORY: /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598
- RUBY EXECUTABLE: /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/bin/ruby
- EXECUTABLE DIRECTORY: /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598/bin
- SPEC CACHE DIRECTORY: /Users/muqaddar/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598/bin
- /Users/muqaddar/.rvm/gems/ruby-2.0.0-p598#global/bin
- /Users/muqaddar/.rvm/rubies/ruby-2.0.0-p598/bin
- /usr/local/mysql/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /Users/muqaddar/.rvm/bin
I tried many things, reading lots of threads.
- reinstall rvm
- remove .vendor/bundle
- bundle install
...etc
I think the gems are not installed in the right directory. How to change that depending my rvm config ?
You should try and follow these steps if you are using a mac: http://www.installrails.com/
Note that when installing a new gem, you first have to add it to the Gemfile inside your editor. For example: gem 'bootstrap-sass', '~> 3.3.3'
After doing this navigate to your folder using terminal and type: "bundle install". This will install your added gems.
I need to use Twitter's twurl command. In so doing I have installed Ruby and then Gem under Linux.
I've downloaded the latest version of twurl but when I attempt to use it to do an install it silently does nothing. I've also tried installing the oauth gem, but the same result. Gem must work because I can do a build using the gemspec file and it creates a gem file.
cam:~/twurl-master$ sudo gem build twurl.gemspec
sh: git: command not found
/usr/local/lib/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:55: command not found: git ls-files
sh: git: command not found
WARNING: description and summary are identical
WARNING: See http://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: twurl
Version: 0.9.2
File: twurl-0.9.2.gem
cam:~/twurl-master$ ls
COPYING Gemfile INSTALL README Rakefile bin lib test twurl-0.9.2.gem twurl.gemspec
cam:~/twurl-master$ sudo gem install twurl
cam:~/twurl-master$ sudo gem install twurl --remote
cam:~/twurl-master$ sudo gem list t
*** LOCAL GEMS ***
cam:~/twurl-master$ sudo gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /home/cam/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/cam/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/X11R6/bin
cam:~/twurl-master$
I am at a loss as to know what to do. I've searched on Google but nobody else seems to have this particular problem. No error message is highly unhelpful...
I'm not sure what is the issue and if that's related, but just in case, twurl gem also requires the gem oauth-0.4.7.
The definitive guide to installing Jekyll seems to be https://github.com/jekyll/jekyll where it says:
gem install jekyll
I am getting an
ERROR: could not find gem jekyll locally or in a repository
regardless of whether I run that command as superuser or not.
gem env Returns the following:
RubyGems Environment:
- RUBYGEMS VERSION: 1.2.0
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.github.com/", "http://gems.rubyforge.org/"]
- REMOTE SOURCES:
- http://gems.github.com/
- http://gems.rubyforge.org/
I have also tried specifying github as the source with no luck. What else should I be trying?
You are using a very outdated version of RubyGems.
First, update the sources:
$ gem sources --clear-all
$ gem sources --add http://rubygems.org
$ gem sources --add http://gems.github.com
Then try to install it.
You should also login as a superuser and update the RubyGems version.
The current release is 1.3.7.