how to solve "ruby installation is missing psych" error?
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.
Related videos on Youtube
Pouya
Updated on November 18, 2020Comments
-
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 over 12 yearsHave you tried to install libyaml following these instructions: pyyaml.org/wiki/LibYAML ?
-
Stoutie over 10 yearsAre you using homebrew? Try
brew doctor
. Does it list a problem with libyaml link? -
Travis Clarke about 7 yearsMac users:
rm -rf /usr/local/lib/ruby/gems/ && brew reinstall ruby
as stated in the official homebrew-core Gtihub resolved issue
-
-
johncblandii about 12 yearsYou actually mean:
rvm package install libyaml
-
jordanpg about 12 yearsNo, he meant
rvm pkg install libyaml
. Fromrvm usage
:pkg :: Install a dependency package {readline,iconv,zlib,openssl}
. -
Vanuan almost 12 yearsI think it depends on what version of rvm you use. In rvm 1.6.9 it is
package
. -
Paul over 11 yearsNo package libtool available. Nothing to do.
-
Paul over 11 yearsdidn't help for job in Jenkins.
-
phil88530 over 11 yearscentos can't yum install libtool? not believe it.. are u using non-redhat based system and need to apt-get?
-
Haralan Dobrev over 11 yearsAfter running
rvm pkg install libyaml
it recommends to reinstall all rubies withrvm reinstall all --force
. It might be useful if you have more than one. -
Sunil Gowda over 11 yearsI had to 'rvm uninstall all' before installing libyaml. That's the only way the error cleared
-
Cristopher Van Paul over 11 years@phil88530 old version of CentOS can be more stupid than you think
-
phil88530 over 11 years@DennisCheung oh ok, never played with an old one
-
Martin Josefsson over 11 yearsShould you use ruby-head or explicity write the version number?
-
Leahcim over 11 yearswhat 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 over 11 yearsyour
gem --version
sounds correct, but maybe you've got your path munged because of former use of rvm -
victorv over 11 yearsI've confirmed this patch is not needed if you are using the latest stable rvm version 1.18.4
-
Dejan over 11 yearsYou might have to do
sudo rvm pkg install libyaml
if you get errors such asError 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 over 11 yearsI had to do this as well. rvm pkg install libyaml didn't do it for me.
-
Chadwick about 11 yearsAnd 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 about 11 yearsHad to do
rvm reinstall 1.9.3 --with-libyaml-dir=/home/rails/.rvm/usr
as suggested in serverfault.com/questions/442150/… -
user1678401 almost 11 yearsYou don't need libyaml: you need libyaml-dev, which is what rvm installs for you with --autolibs
-
Stoutie over 10 yearsResolving all
brew doctor
issues fixed it for me. I got an error very similar to the questioner's error while trying togem 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 thebrew doctor
issues eliminated every single error message. Now everything is working smoothly. -
Stoutie over 10 yearsSometimes 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 thebrew doctor
issues, especially thebrew link --overwrite libyaml
fixed it for me. -
Peter Degen-Portnoy about 10 yearsI 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 almost 10 yearsrvm dpkg depricated. Use rvm autolibs
-
zishe almost 10 yearsThis question about os x.
-
Fu Xu over 9 yearsthx :) but
rvm pkg
was deprecated,rvm autolibs
was recommended :) -
marcovtwout over 8 yearsAlso confirmed on Centos 5.6
-
Sandeep Ahuja about 8 yearsThanks @user33302. Above solution also worked for me on Mac OS EI CAPITON.
-
mrudult over 7 yearsI instead allowed rvm to handle everything and did
rvm requirements
. That solved the problem. -
orome over 6 yearsBut
gem list
is what causes the error in the first place (for me). -
mljrg over 6 yearsI 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 almost 3 yearsFor version 3.0.0
rvm reinstall ruby-3.0.0-p0