Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.
brew installing one, specific Homebrew/homebrew-core formula (not cask or tap) and not every time you run brew? If it's a general brew problem please file this issue at https://github.com/Homebrew/brew/issues/new. If it's a brew cask problem please file this issue at https://github.com/Homebrew/caskroom/homebrew-cask/new. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.brew update and retried your prior step?brew doctor, fixed all issues and retried your prior step?brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?To help us debug your issue please explain:
brew install commands)After updating Ruby to 2.4.2, encountered the following error when doing gem install. Have confirmed libyaml is already installed vis Homebrew. Ruby 2.4.1_2 works fine.
/usr/local/Cellar/ruby/2.4.2/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.2/lib/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.1.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/Cellar/ruby/2.4.2/lib/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/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/yaml.rb:6:in `<top (required)>'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems.rb:701:in `load_yaml'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/config_file.rb:340:in `load_file'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/config_file.rb:202:in `initialize'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/gem_runner.rb:75:in `new'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/gem_runner.rb:75:in `do_configuration'
from /usr/local/Cellar/ruby/2.4.2/lib/ruby/2.4.0/rubygems/gem_runner.rb:40:in `run'
from /usr/local/bin/gem:21:in `<main>'
To get formulae added or changed in Homebrew please file a Pull Request
We will close issues requesting formulae changes.
CC @DomT4
What explicit command are you executing to run into this issue? Just gem install?
psych uses native extensions which are likely still linked to the old dylib. I know psych is a default gem but I think you can also install it manually, and _that_ psych may well have borked linkage.
=> git checkout dff132bdbe55eb676e7f77015c7ad243a86a733e
=> brew rm ruby && brew install ruby
=> /usr/local/bin/gem install psych
=> git checkout master
=> brew upgrade ruby
=> /usr/local/bin/gem install
Yeah. That reproduces it. Once gem is borked it seems to be borked until the .bundles are dead, that's fun. You can fix it like this:
=> rm -f /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4/lib/psych.bundle
=> rm -f /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-17/2.4.0/psych-2.2.4/psych.bundle
=> /usr/local/bin/gem uninstall psych
_(Apologies for edits, decided to squash my three comments back into one)_.
um so how do we prevent this from happening to everyone?
IMO, not _really_ our problem. It feels like stupid behaviour for gem to permit the loading of installed gems over default gems when those gems are absolutely required to achieve functionality.
From lib/ruby/2.4.0/rubygems.rb:
def self.load_yaml
return if @yaml_loaded
return unless defined?(gem)
test_syck = ENV['TEST_SYCK']
# Only Ruby 1.8 and 1.9 have syck
test_syck = false unless /^1\./ =~ RUBY_VERSION
unless test_syck
begin
gem 'psych', '>= 1.2.1'
rescue Gem::LoadError
# It's OK if the user does not have the psych gem installed. We will
# attempt to require the stdlib version
end
begin
# Try requiring the gem version *or* stdlib version of psych.
require 'psych'
rescue ::LoadError
# If we can't load psych, thats fine, go on.
else
# If 'yaml' has already been required, then we have to
# be sure to switch it over to the newly loaded psych.
if defined?(YAML::ENGINE) && YAML::ENGINE.yamler != "psych"
YAML::ENGINE.yamler = "psych"
end
require 'rubygems/psych_additions'
require 'rubygems/psych_tree'
end
end
@chuanconggao this seems worth reporting upstream if you're feeling up to it. Thanks for bringing it to our attention.
For the record, in case anyone else is still having this issue, I was having this error, and noticed I had different versions of Ruby installed with HomeBrew, along with many gems that I no longer used. So did a full clean up like this:
$ brew remove --force ruby # remove all versions installed
$ sudo rm -rf /usr/local/lib/ruby # remove all gems and leftover files
$ brew install ruby
$ gem install bundler
$ bundle install
I'm still have a load problem in require step.
I found "bio" and "pry" cannot be required in ruby 2.4.2 with rubygem 2.6.13.
Probably, they are executable command including gems.
Do you know a good solution?
Sorry. I miss understand the return value in "pry".
I can use these gems but the return value when require these gems in "pry".
Do you know the reason why these return values, true or false, from different gems when required?
I'm still having this issue and tried the workaround from @eneko. On gem install bundler I still get the issue with It seems your ruby installation is missing psych (for YAML output). and can't install any gem. All worked with 2.4.1, but brew install [email protected] doesn't work, only brew install [email protected] works, which installs 2.4.2.
There's no such formula[email protected]. Did you try the instructions in https://github.com/Homebrew/homebrew-core/issues/18123#issuecomment-329845818
This returns
/usr/local/Homebrew (stable) $ git checkout dff132bdbe55eb676e7f77015c7ad243a86a733e
fatal: reference is not a tree: dff132bdbe55eb676e7f77015c7ad243a86a733e
And as I did sudo rm -rf /usr/local/lib/ruby from https://github.com/Homebrew/homebrew-core/issues/18123#issuecomment-330926209, all gems were removed. Also /usr/local/lib/ruby/gems/2.4.0/gems/psych-2.2.4 doesn't exists on my machine.
what is the output of ls /usr/local/lib/ruby/gems
$ ls /usr/local/lib/ruby/gems
2.4.0
$ ls /usr/local/lib/ruby/gems/2.4.0/
cache gems specifications
$ ls /usr/local/lib/ruby/gems/2.4.0/gems/
did_you_mean-1.1.0 minitest-5.10.1 net-telnet-0.1.1 power_assert-0.4.1 rake-12.0.0 rdoc-5.0.0 test-unit-3.2.3 xmlrpc-0.2.1
@attrib you'll need to open a new issue and fill out the template completely because it doesn't look like it's the same as this one.
Most helpful comment
For the record, in case anyone else is still having this issue, I was having this error, and noticed I had different versions of Ruby installed with HomeBrew, along with many gems that I no longer used. So did a full clean up like this: