17 December 2012
Installing Ruby used to be easy, but I came across this tricky problem when doing some upgrades on my rails server. Anytime I ran the gem command on my new ruby install, I get the warning:
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
I came across this post, which claims to fix the problem, but it didn't for me.
Anyway, what I did to get it working was follow the instructions in the post above:
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar xzvf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4
$ ./configure --prefix=/usr/local
$ make
$ make install
Then install Ruby:
$ ./configure --prefix=/usr/local/lib/ruby_1.9.3 --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
$ make
$ make install
However, the problem persisted. To fix it, all I did was:
$ cp /usr/local/lib/libyaml* /usr/local/lib/ruby_1.9.3/lib
Problem solved - 2 hours into a 15 minute task :-(