1

Whenever I start the shell I get an error from it saying that it could not load a gem, curiously named ubygems (notice the lack of r).

➜ reload                       
Traceback (most recent call last):
    1: from /home/ux/.asdf/installs/ruby/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/home/ux/.asdf/installs/ruby/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- ubygems (LoadError)

 * keychain 2.8.2 ~ http://www.funtoo.org
 * Found existing ssh-agent: 6895
 * Known ssh key: /home/ux/.ssh/id_rsa

Startup time: 623610 ms

Is this an issue with asdf or could it be something else?

Flux
  • 9,805
  • 5
  • 46
  • 92
Paulo Phagula
  • 387
  • 4
  • 14

1 Answers1

2

That feature (ubygems.rb) was removed in ruby 2.5: https://github.com/rubygems/rubygems/issues/2393

It was used to do a require "rubygems" from command-line, like this:

ruby -rubygems ...

Note that the "r" in -rubygems is a flag, meaning "require". And "ubygems" is the thing it requires. It was needed when rubygems weren't loaded by default. But now they are, so the feature doesn't make sense anymore.

You should change the command that opens the shell. Or switch to ruby before 2.5

Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367
  • You're right... Based on your comment and the ones above, I can now confirm this is actually coming from something I have on my `zshenv` which reads like `export PATH="$PATH:$(ruby -rubygems -e 'puts Gem.user_dir')/bin"` Running that bit on the shell results in the error I reported above. And only recently I began using Ruby > 2.5. What is the correct way of accomplishing what the line tries to accomplish in Ruby > 2.5? – Paulo Phagula Apr 14 '19 at 22:11
  • Found the answer on the linked Issue on Github. I need to have `ruby -rrubygems ...` instead of a single r like I was doing – Paulo Phagula Apr 14 '19 at 22:15
  • 1
    @PauloPhagula You can drop the flag altogether. – Sergio Tulentsev Apr 15 '19 at 07:22