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

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

Closed
pzula opened this issue Mar 10, 2014 · 24 comments
Closed

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

pzula opened this issue Mar 10, 2014 · 24 comments

Comments

@pzula
Copy link

pzula commented Mar 10, 2014

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?

@mpapis
Copy link
Member

mpapis commented Mar 10, 2014

can you please show me:

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

@pzula
Copy link
Author

pzula commented Mar 11, 2014

@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
Copy link
Member

mpapis commented Mar 11, 2014

hmm, nothing obvious, now run:

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

@mpapis
Copy link
Member

mpapis commented Mar 11, 2014

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

@pzula
Copy link
Author

pzula commented Mar 11, 2014

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
Copy link
Member

mpapis commented Mar 11, 2014

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

@mpapis mpapis added the OSX label Mar 11, 2014
@pzula
Copy link
Author

pzula commented Mar 11, 2014

@mpapis, here is that output: https://gist.github.com/pzula/9484355

@mpapis
Copy link
Member

mpapis commented Mar 11, 2014

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

@pzula
Copy link
Author

pzula commented Mar 11, 2014

@mpapis
Copy link
Member

mpapis commented Mar 11, 2014

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

@tomjoro
Copy link

tomjoro commented Mar 17, 2014

brew unlink libyaml && brew link libyaml

@mpapis
Copy link
Member

mpapis commented Mar 17, 2014

I gave this problem some thinking and this bug can not be detected before you install ruby, this means we can not fix it on the autolibs level, so the only thing I can easily add is an warning, but still, I would prefer MRI take on the problem, please link me to the issue when it gets created

@ekilfeather
Copy link

This worked for me but I also needed to;

brew unlink openssl  && brew link --force openssl

@thanhnguyen9
Copy link

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
Copy link
Member

mpapis commented May 20, 2014

@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
Copy link

mcka1n commented May 20, 2014

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

@thanhnguyen9
Copy link

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
Copy link
Contributor

rys commented May 22, 2014

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

@thanhnguyen9
Copy link

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

@thanhnguyen9
Copy link

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
Copy link
Member

mpapis commented May 29, 2014

@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
Copy link
Member

mpapis commented Jun 6, 2014

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
Copy link

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
Copy link

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

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

No branches or pull requests

10 participants