Skip to content

Mavericks, cannot install gems because libyaml is missing? #2689

Closed
@pzula

Description

@pzula

I've tried using RVM since I've upgraded to OSX Mavericks, and I've come across the same issue more than once while trying to install gems.

When using Ruby 2.1.1 as my installation, and running gem install minitest, I received the following error:

gem install minitest
/Users/pzula/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/yaml.rb:4: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.
/Users/pzula/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/pzula/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/psych.bundle, 9): Library not loaded: /usr/local/lib/libyaml-0.2.dylib (LoadError)
...........

Having read the error message, I thought perhaps I somehow have autolibs turned off, so I went ahead and removed RVM from the system, and reinstalled using the following command:

\curl -sSL https://get.rvm.io | bash -s stable --ruby

However, even after reinstalling RVM, I am unable to install gems due to the libyaml error. Am I doing something incorrectly? Do I have to install libyaml separately?

Activity

mpapis

mpapis commented on Mar 10, 2014

@mpapis
Member

can you please show me:

  1. rvm reinstall 2.1.1 --debug
  2. rvm use 2.1.1 ; ruby -wdS gem install minitest
pzula

pzula commented on Mar 11, 2014

@pzula
Author

@mpapis, here is the output of rvm reinstall 2.1.1 --debug: https://gist.github.com/pzula/9477008
and here is the output of the second command: https://gist.github.com/pzula/9477024

mpapis

mpapis commented on Mar 11, 2014

@mpapis
Member

hmm, nothing obvious, now run:

find /Users/pzula/.rvm/{gems,rubies}/ruby-2.1.1 -name psych.bundle
mpapis

mpapis commented on Mar 11, 2014

@mpapis
Member

btw. was this ruby initially upgraded from older version or installed?

pzula

pzula commented on Mar 11, 2014

@pzula
Author

I initially have everything working before upgrading to Mavericks. After the upgrade, nothing worked, so I uninstalled & reinstalled.

Output of find:

pzula checkerboard (master) ✨  find /Users/pzula/.rvm/{gems,rubies}/ruby-2.1.1 -name psych.bundle
/Users/pzula/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/psych.bundle
mpapis

mpapis commented on Mar 11, 2014

@mpapis
Member

ah it complains that /Users/pzula/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/psych.bundle can not find /usr/local/lib/libyaml-0.2.dylib this path is from homebrew, show me:

otool -L /Users/pzula/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/psych.bundle
find /usr/local -name libyaml*.dylib
yaml_name=$( pkg-config --list-all | awk '/^yaml[- ]/{print $1}' )
echo $yaml_name
pkg-config $yaml_name --variable=prefix

I'm getting a feeling it's another time when you need to link packages in homebrew event they are keg only

pzula

pzula commented on Mar 11, 2014

@pzula
Author
mpapis

mpapis commented on Mar 11, 2014

@mpapis
Member

you should be able to fix the problem with:

brew link libyaml

but then it makes brew doctor unhappy, so now show me:

  • /Users/pzula/.rvm/src/ruby-2.1.1/ext/psych/mkmf.log
  • /Users/pzula/.rvm/src/ruby-2.1.1/ext/psych/Makefile

also check Homebrew/legacy-homebrew#26367

mpapis

mpapis commented on Mar 11, 2014

@mpapis
Member

It looks like somehow ruby/homebrew links to wrong libyaml library, please open a bug for ruby here: https://bugs.ruby-lang.org/projects/ruby-trunk/issues/new
include this gists:

you can mention this ticket and the homebrew one Homebrew/legacy-homebrew#26367

as it might take some time to get answer there try this to get temporary fix:

brew link libyaml

3 remaining items

thanhnguyen9

thanhnguyen9 commented on May 16, 2014

@thanhnguyen9

I have the same problem. Would somebody plz help me? My system
ruby 2.1.1
rails 4.1.1
rvm 1.25.25
bundler 1.6

https://gist.github.com/thanh8604/bb5996524b4febbe21ea

mpapis

mpapis commented on May 20, 2014

@mpapis
Member

@thanh8604 no it does not look like the same problem, you need to read the log, it points to a problem in your file /Users/thanhnguyen/Downloads/learn_ruby-master/00_hello/hello.rb:7: syntax error, unexpected keyword_end (SyntaxError)

mcka1n

mcka1n commented on May 20, 2014

@mcka1n

phew! @tomjoro yeah it works, you just saved my day :) 👍

thanhnguyen9

thanhnguyen9 commented on May 21, 2014

@thanhnguyen9

Ive already fix that "end" problem. I think my ruby don't have enough gem or spec. Do y'all have any idea? I've been struggling with this for a month and still stuck. Cant get it run.

rys

rys commented on May 22, 2014

@rys
Contributor

@thanh8604 can you please file a new issue with your problem and gist the current output on your system so we can help

thanhnguyen9

thanhnguyen9 commented on May 24, 2014

@thanhnguyen9

This is what i get. Thank you for ur answer.
https://gist.github.com/thanh8604/bb5996524b4febbe21ea

thanhnguyen9

thanhnguyen9 commented on May 28, 2014

@thanhnguyen9

This is what i get. Plz help me
https://gist.github.com/thanh8604/bb5996524b4febbe21ea

On Thu, May 22, 2014 at 5:58 PM, Rys Sommefeldt notifications@github.comwrote:

@thanh8604 https://github.com/thanh8604 can you please file a new issue
with your problem and gist the current output on your system so we can help


Reply to this email directly or view it on GitHubhttps://github.com//issues/2689#issuecomment-43954098
.

mpapis

mpapis commented on May 29, 2014

@mpapis
Member

@thanh8604 it's not RVM problem, please read the error again, it shows you that is not a function, it is a double quote but it is not the one that you were supposed to use "” - I guess your editor might be changing your quotes, make sure they all are the same"` and you should be fine

mpapis

mpapis commented on Jun 6, 2014

@mpapis
Member

closing as the problem does not repeat that often (any more) and I already forgot the idea about warning, if you hit tis problem again please let me know

asbjornu

asbjornu commented on Aug 20, 2014

@asbjornu

I got the installing gem fails with permission error when trying to do gem install cocoapods, which made me search for a solution mentioning rvm. The problem is that rvm doesn't seem to be available in Homebrew. However, rbenv is. So even though my solution relates to rbenv, I believe rvm and rbenv does something so similar that this comment might be worthwile having out there.

After installing rbenv, I got the problem mentioned in this thread about libyaml not being installed. What fixed that problem was typing this in the terminal:

brew unlink libyaml && brew link libyaml

After that, I now have a ruby gem setup with gem env returning:

  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.1.0
     - /Users/aul/.gem/ruby/2.1.0
     - /usr/local/Cellar/ruby/2.1.2_2/lib/ruby/gems/2.1.0

As well as gem install cocoapods now working. Which is sweet. :)

amboxer21

amboxer21 commented on Dec 25, 2015

@amboxer21

Why the fuck is everyone using rmv? Is everyone that lazy and cant navigate a Linux terminal?

added this to the rvm-1.27.0-before milestone on May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @asbjornu@rys@mpapis@pkuczynski@tomjoro

        Issue actions

          Mavericks, cannot install gems because libyaml is missing? · Issue #2689 · rvm/rvm