Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to Ruby 2.4.1_1 breaks gem command. #11636

Closed
3 tasks done
dawoonchung opened this issue Mar 27, 2017 · 27 comments
Closed
3 tasks done

Upgrading to Ruby 2.4.1_1 breaks gem command. #11636

dawoonchung opened this issue Mar 27, 2017 · 27 comments

Comments

@dawoonchung
Copy link

dawoonchung commented Mar 27, 2017

  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • Confirmed this is a problem with specific formulae and not Homebrew/brew? If it's a general Homebrew/brew problem please file this issue at https://github.com/Homebrew/brew/issues/new

After upgrading Ruby to latest 2.4.1_1 formula, gem command no longer works and gives the following error:

/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/yaml.rb:5:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4/lib/psych.bundle, 9): Library not loaded: /usr/local/opt/ruby/lib/libruby.2.4.0.dylib (LoadError)
  Referenced from: /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4/lib/psych.bundle
  Reason: image not found - /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4/lib/psych.bundle
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4/lib/psych.rb:8:in `<top (required)>'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/yaml.rb:6:in `<top (required)>'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems.rb:700:in `load_yaml'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/config_file.rb:340:in `load_file'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/config_file.rb:202:in `initialize'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/gem_runner.rb:75:in `new'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/gem_runner.rb:75:in `do_configuration'
	from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/gem_runner.rb:40:in `run'
	from /usr/local/bin/gem:21:in `<main>'

I tried both

brew reinstall -s libyaml

and

brew reinstall -s ruby

but none of them resolved the issue.

Could anyone help me fix this?
Many thanks.

@dawoonchung dawoonchung changed the title Upgrading to Ruby 2.4.1_1 breaks gem. Upgrading to Ruby 2.4.1_1 breaks gem command. Mar 27, 2017
@ilovezfs
Copy link
Contributor

maybe

rm -rf /usr/local/lib/ruby/site_ruby/
brew uninstall ruby
brew install ruby
gem install psych

@dawoonchung
Copy link
Author

@ilovezfs Thanks for the suggestion, but it still didn't resolve the issue, throwing the same error.

@ilovezfs
Copy link
Contributor

what command are you running

@dawoonchung
Copy link
Author

I followed your steps for removing and installing Ruby, and I tried any gem command – just gem, gem update, gem update --system, gem install psych, and so on, but none of them works.

@ilovezfs
Copy link
Contributor

looks fine here starting from clean install: https://gist.github.com/ilovezfs/48a77d39c08220f34d9e8ead7d51656b

so not sure what to tell you

@dawoonchung
Copy link
Author

Strange. I tried with ruby@2.3, and it is working without any problem. But as soon as I upgrade it to 2.4.1, the problem pops up again.

@ilovezfs
Copy link
Contributor

what's output for brew config and brew doctor

@dawoonchung
Copy link
Author

dorapen@~$ brew config
HOMEBREW_VERSION: 1.1.11
ORIGIN: https://github.com/Homebrew/brew
HEAD: 394f9fa0aaa5854aa52bc589708a079665dcf462
Last commit: 3 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e360ded5f8533c30e58a095b2263965af8d50988
Core tap last commit: 17 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.12.2 => /usr/local/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.24.1/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.4.1_1/bin/ruby
Java: 1.8.0_121, 1.8.0_112, 1.7.0_80
macOS: 10.12.3-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11
dorapen@~$ brew doctor
Your system is ready to brew.

@Bufallo
Copy link

Bufallo commented Mar 27, 2017

Im having the exact same problem.
All i did was brew update && brew upgrade and now gem is not working anymore.

I tried to reinstall both libyaml and ruby, but the error stays the same.

I checked if psych is there on my system. Everything seems to be there.

But /usr/local/opt/ruby/lib/libruby.2.4.0.dylib from the error message is not there.
How can i get this dylib?

@ilovezfs
Copy link
Contributor

@xu-cheng Any ideas here? I notice you may have done some related work on this in adfcc5a.

@xu-cheng
Copy link
Member

Please try rm -rf /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4.

It is most likely a different version of psych is installed by users. However, that version is incorrectly linked to wrong lib file, which should be caused by the incorrect abi_version in #11474

@ilovezfs
Copy link
Contributor

@dorapen @Bufallo please give that a try.

@ilovezfs ilovezfs added the needs response Needs a response from the issue/PR author label Mar 27, 2017
@BrewTestBot BrewTestBot removed the needs response Needs a response from the issue/PR author label Mar 27, 2017
@ilovezfs ilovezfs added the needs response Needs a response from the issue/PR author label Mar 27, 2017
@dawoonchung
Copy link
Author

@ilovezfs @xu-cheng Nope, it didn't resolve the issue. I tried to reinstall ruby after deleting psych, both with brew reinstall ruby and brew reinstall -s ruby but neither worked. Also reinstalling libyaml didn't work.

@BrewTestBot BrewTestBot removed the needs response Needs a response from the issue/PR author label Mar 27, 2017
@dawoonchung
Copy link
Author

This time following psych was referenced:

Referenced from: /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/psych-2.2.4/psych.bundle

@xu-cheng
Copy link
Member

@dorpen What is the error message? Is it a different gem reporting the error?

A dramatical solution would be:

rm -rf /usr/local/lib/ruby
brew reinstall ruby

However, this would remove all installed rubygems.

@xu-cheng
Copy link
Member

@dorapen Oh, you could remove that file as well.

@dawoonchung
Copy link
Author

@xu-cheng Here's the error message:

dorapen@~$ gem
/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/yaml.rb:5:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/psych-2.2.4/psych.bundle, 9): Library not loaded: /usr/local/opt/ruby/lib/libruby.2.4.0.dylib (LoadError)
  Referenced from: /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/psych-2.2.4/psych.bundle
  Reason: image not found - /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/psych-2.2.4/psych.bundle
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/psych.rb:8:in `<top (required)>'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/yaml.rb:6:in `<top (required)>'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems.rb:700:in `load_yaml'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/config_file.rb:340:in `load_file'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/config_file.rb:202:in `initialize'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/gem_runner.rb:75:in `new'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/gem_runner.rb:75:in `do_configuration'
	from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/gem_runner.rb:40:in `run'
	from /usr/local/bin/gem:21:in `<main>'

@dawoonchung
Copy link
Author

Oh hey! That solved it! So both:

rm -rf /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4

and

rm -rf /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/psych-2.2.4

seems to do the trick! Thanks!!

@ilovezfs
Copy link
Contributor

ilovezfs commented Mar 27, 2017

@Bufallo does that take care of it for you too?

@Bufallo
Copy link

Bufallo commented Mar 27, 2017

Yes!
After removing the psych gem wir rm -rf the gem command is working again.

@ilovezfs
Copy link
Contributor

Perfect. Thanks for the speedy help here @xu-cheng. It's much appreciated.

@dawoonchung
Copy link
Author

Many thanks to you both for the support, @ilovezfs and @xu-cheng!

@kud
Copy link
Contributor

kud commented Mar 29, 2017

Thank you so much for the solution. :)

@AndreTheHunter
Copy link
Sponsor Contributor

Worked for me too!

rm -rf /usr/local/lib/ruby/gems/
brew uninstall ruby --ignore-dependencies
brew install ruby

@joneslm1
Copy link

joneslm1 commented Apr 4, 2017

Thanks so much for this!!!

@irliao
Copy link

irliao commented Apr 8, 2017

@dorapen's solution above worked, thank you so much!

@huebs
Copy link

huebs commented Apr 12, 2017

I've been dealing with the same error and @dorapen's solution worked for me:

rm -rf /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4
rm -rf /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/psych-2.2.4

Thank you!!!

@Homebrew Homebrew locked and limited conversation to collaborators Apr 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants