how to solve "ruby installation is missing psych" error?

102,599

Solution 1

In my case

rvm pkg install libyaml

and

rvm reinstall ruby-1.9.3-p125

solved the problem.

For people using Ubuntu, make sure that libtool is installed prior to the steps above:

sudo apt-get install libtool

For macOS users (with homebrew):

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

Solution 2

If not using rvm, but rather you are building and installing ruby 1.9.3 from scratch — for example, you're managing your ruby versions with rbenv — you must install libyaml first. Get it from http://pyyaml.org/; at the moment, the file you want is http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz. Open the tarball and cd into the resulting folder. Then:

./configure --prefix=/usr/local
make
sudo make install

You are now ready to build ruby. Download ruby from http://ftp.ruby-lang.org/pub/ruby/. Open the tarball and cd into the resulting folder. Now:

./configure --prefix=/wherever/you/want/it/to/go
make
make install

(Or possibly sudo make install, depending on where you're putting it.) If using rbenv, you'll know it has worked if you switch to rbenv global 1.9.3-p194 (or whatever your version is called) and gem --version works without a warning. That worked for me on Mac OS X 10.6.8. (Update: I just tried this on Mac OS X 10.8.1 and it seems to have worked fine there too.)

Solution 3

for ubuntu and rvm

sudo apt-get install libtool
rvm pkg install libyaml
rvm reinstall 1.9.3

worked

Solution 4

brew install libyaml
rvm reinstall 1.9.3

Is what worked for me (on Snow Leopard).

Solution 5

In my case the solution was to add the psych gem to the Gemfile.

Share:
102,599

Related videos on Youtube

Pouya
Author by

Pouya

Updated on November 18, 2020

Comments

  • Pouya
    Pouya over 3 years

    I used rvm to install ruby 1.9.3. even though it was successfully installed, it complained about libyaml. and now every time i wanna install a gem (say rails) this warning shows up:

    It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.
    

    I use Mac os X 10.7 (Lion).

    • sailor
      sailor over 12 years
      Have you tried to install libyaml following these instructions: pyyaml.org/wiki/LibYAML ?
    • Stoutie
      Stoutie over 10 years
      Are you using homebrew? Try brew doctor. Does it list a problem with libyaml link?
    • Travis Clarke
      Travis Clarke about 7 years
      Mac users: rm -rf /usr/local/lib/ruby/gems/ && brew reinstall ruby as stated in the official homebrew-core Gtihub resolved issue
  • johncblandii
    johncblandii about 12 years
    You actually mean: rvm package install libyaml
  • jordanpg
    jordanpg about 12 years
    No, he meant rvm pkg install libyaml. From rvm usage: pkg :: Install a dependency package {readline,iconv,zlib,openssl}.
  • Vanuan
    Vanuan almost 12 years
    I think it depends on what version of rvm you use. In rvm 1.6.9 it is package.
  • Paul
    Paul over 11 years
    No package libtool available. Nothing to do.
  • Paul
    Paul over 11 years
    didn't help for job in Jenkins.
  • phil88530
    phil88530 over 11 years
    centos can't yum install libtool? not believe it.. are u using non-redhat based system and need to apt-get?
  • Haralan Dobrev
    Haralan Dobrev over 11 years
    After running rvm pkg install libyaml it recommends to reinstall all rubies with rvm reinstall all --force. It might be useful if you have more than one.
  • Sunil Gowda
    Sunil Gowda over 11 years
    I had to 'rvm uninstall all' before installing libyaml. That's the only way the error cleared
  • Cristopher Van Paul
    Cristopher Van Paul over 11 years
    @phil88530 old version of CentOS can be more stupid than you think
  • phil88530
    phil88530 over 11 years
    @DennisCheung oh ok, never played with an old one
  • Martin Josefsson
    Martin Josefsson over 11 years
    Should you use ruby-head or explicity write the version number?
  • Leahcim
    Leahcim over 11 years
    what should gem --version output? I installed Ruby 1.9.3-p327 but gem --version outputs 1.8.23 (not sure if that's related) and when I do bundle update, it strangely says that some gems are requiring => 1.9.2 stackoverflow.com/questions/14116083/…
  • matt
    matt over 11 years
    your gem --version sounds correct, but maybe you've got your path munged because of former use of rvm
  • victorv
    victorv over 11 years
    I've confirmed this patch is not needed if you are using the latest stable rvm version 1.18.4
  • Dejan
    Dejan over 11 years
    You might have to do sudo rvm pkg install libyaml if you get errors such as Error running 'tar xmzf /Users/Kieran/.rvm/archives/yaml-0.1.4.tar.gz -C /Users/Kieran/.rvm/src ', please read /Users/Kieran/.rvm/log/yaml/extract.log. This is because for some reason it doesn't have permissions to remove folders and replace them.
  • stringo0
    stringo0 over 11 years
    I had to do this as well. rvm pkg install libyaml didn't do it for me.
  • Chadwick
    Chadwick about 11 years
    And if you must install yaml without sudo, specify a prefix other than /usr/local when configuring yaml, then configure ruby with --with-opt-dir=/path/to/yaml/prefix --with-yaml --prefix=/path/to/ruby/prefix
  • pcv
    pcv about 11 years
    Had to do rvm reinstall 1.9.3 --with-libyaml-dir=/home/rails/.rvm/usr as suggested in serverfault.com/questions/442150/…
  • user1678401
    user1678401 almost 11 years
    You don't need libyaml: you need libyaml-dev, which is what rvm installs for you with --autolibs
  • Stoutie
    Stoutie over 10 years
    Resolving all brew doctor issues fixed it for me. I got an error very similar to the questioner's error while trying to gem install jekyll. All commands through rvm were giving errors too. The underlying and not so obvious problem is that homebrew, I'm assuming the means by which rvm installs stuff, was having issues. I had recently upgraded to Mavericks on Mac OS. In my case, resolving all the brew doctor issues eliminated every single error message. Now everything is working smoothly.
  • Stoutie
    Stoutie over 10 years
    Sometimes a question deserves a question, not an assumptive answer, to get at the root problem. In my case, I got a very similar error when doing gem install jekyll. My rvm commands were also giving me errors. I had recently upgraded to Mavericks. I think that broke some of the brew links, including libyaml. I did also reinstall rvm and ruby as well, but I'm not convinced that was an essential part of the solution. I believe resolving all the brew doctor issues, especially the brew link --overwrite libyaml fixed it for me.
  • Peter Degen-Portnoy
    Peter Degen-Portnoy about 10 years
    I know this is over a year old, but the question was about an error with RVM. How could starting with "If not using rvm" be appropiate?
  • twinturbotom
    twinturbotom almost 10 years
    rvm dpkg depricated. Use rvm autolibs
  • zishe
    zishe almost 10 years
    This question about os x.
  • Fu Xu
    Fu Xu over 9 years
    thx :) but rvm pkg was deprecated, rvm autolibs was recommended :)
  • marcovtwout
    marcovtwout over 8 years
    Also confirmed on Centos 5.6
  • Sandeep Ahuja
    Sandeep Ahuja about 8 years
    Thanks @user33302. Above solution also worked for me on Mac OS EI CAPITON.
  • mrudult
    mrudult over 7 years
    I instead allowed rvm to handle everything and did rvm requirements. That solved the problem.
  • orome
    orome over 6 years
    But gem list is what causes the error in the first place (for me).
  • mljrg
    mljrg over 6 years
    I am on macOS Sierra, and this worked for me. It is the same solution reported in this GitHub issue here Try this solution first as it is much simpler and less drastic than the others in this page.
  • Tharindu Madushanka
    Tharindu Madushanka almost 3 years
    For version 3.0.0 rvm reinstall ruby-3.0.0-p0