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 s
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.)
I reinstalled ruby 1.9.3 with libyaml support:
rvm reinstall 1.9.3 --with-libyaml
I made sure that I would use 1.9.3 before installing psych:
rvm use 1.9.3
I installed psych:
gem install psych
I tried all of these answers and still wasn't able to get it working. I installed libyaml with homebrew and then installed Ruby 1.9.3 and 2.0.0 with rvm. Each time it complained that I was missing psych (libyaml). But trying to install libyaml told me it was already installed. Rinse, repeat. Urgh.
Finally, what I did was to uninstall libyaml. Then I enabled autolibs in rvm, which (at least in OSX) allows rvm to install and manage dependencies more directly. Now when I installed the Rubies, rvm was able to install libyaml and recognize that it was in the right spot.
So if you've tried all of the other options, try actually removing libyaml and then installing your Rubies. It's count-intuitive from the error messages, but that's what finally worked for me.
I spent a few hours trying to get my error to go away and none of the replies here suited my case, so I thought I would post how I solved it...
In my case when I ran gem list | grep psych
, I had the following output: psych(default: 3.1.0, default: 3.0.2)
.
Apparently since version 2.5.0, ruby depends on the newer version of psych (3.1.0) and having both set as default was messing up everything. Notice that I never ended up finding out why those were both set as default - I completely wiped out rvm and ruby versions from my computer due to this.
So in order to remove the older version (3.0.2) from being set as default, head to ~/.rvm/gems/ruby-x.x.x@global/specifications/default
. If you run ls | grep psych
it will return both versions of the gem here. If you want to maintain 3.1.0 as default just run mv psych-3.0.2.gemspec ../
and then try running gemlist
to make sure it is listing only one version as default now...
tl;dr
cd /.rvm/gems/ruby-x.x.x@global/specifications/default
mv psych-3.0.2 ../
Hope this helps someone!
Installing ruby with rvm for mac osx, use autolibs to install libyaml and first uninstalling libyaml helps.
This worked for me:
brew uninstall libyaml
rvm autolibs enable
rvm reinstall ruby-2.1.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