4

on a mac os 10.12.6 after i try sudo gem install rake or

i get this error message:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rubygems/core_ext/kernel_warn (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Site/2.0.0/rubygems.rb:1395:in `<top (required)>'
    from <internal:gem_prelude>:1:in `require'
    from <internal:gem_prelude>:1:in `<compiled>'

The is error throws any gem install Ruby version is 2.0.0, Ive tried updating ruby with homebrew but whni try installing home brew i get the same error.

Cant seem to edit /Library/Ruby/Site/2.0.0/rubygems.rb:1395

TrimTrimm
  • 103
  • 1
  • 9

3 Answers3

1

This is possibly related to issue #2535 in rubygems fixed in release 3.0.1.

Try gem update --system

jwadsack
  • 5,708
  • 2
  • 40
  • 50
1

All suggested solutions didn't fully work for me, although gem update --system seems to be a good idea, because it updates ruby. BUT: On my Mac, the system version didn't step back after the update, although ruby -v gave the correct new version. The described error remained for me, e.g. while using homebrew with brew update:

$ brew update
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rubygems/core_ext/kernel_warn (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Site/2.3.0/rubygems.rb:1395:in `<top (required)>'
    from <internal:gem_prelude>:4:in `require'
    from <internal:gem_prelude>:4:in `<internal:gem_prelude>'

The only thing that helped me was the following as described here:

sudo rm -f '/usr/local/bin/update_rubygems'
sudo rm -rf '/Library/Ruby/Site/2.3.0'

Hope to help some folks (I'am on MacOS 10.14.2).

jonashackt
  • 12,022
  • 5
  • 67
  • 124
0

You are going to have problems using system ruby or messing with it's gems. You are far better off to use a ruby version manager where you may have different versions of ruby per project. I highly recommend RVM.

See here for how to install

Did you also try to run gem install bundler?

Post output of these commands if they don't give you an error

ruby -v
which ruby
gem env
lacostenycoder
  • 10,623
  • 4
  • 31
  • 48
  • Ive already tried using rvm but i get an error for that as well when I run **rvm install 2.6** saying it can't update homebrew and it failed to install the version of ruby Requirements installation failed with status: 255. – TrimTrimm Oct 26 '18 at 17:46
  • ruby -v ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16] – TrimTrimm Oct 29 '18 at 15:02
  • which ruby /usr/bin/ruby – TrimTrimm Oct 29 '18 at 15:03
  • 1
    gem env /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rubygems/core_ext/kernel_warn (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /Library/Ruby/Site/2.0.0/rubygems.rb:1395:in `' from :1:in `require' from :1:in `' – TrimTrimm Oct 29 '18 at 15:03
  • @TrimTrimm please post that as code in your question, hard to read this way – lacostenycoder Oct 29 '18 at 15:06