Total Pageviews

Monday 10 June 2013

"please install libyaml and reinstall your ruby."的解决

 如果你编译ruby后,安装某个gem,比如: # gem install heroku
却遇到提示:
"It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby."

解决方法:首先
# apt-get install libyaml-dev
# cd /path/to/extracted-dir-of-ruby_package/ext/psych/
# ruby extconf.rb
# make
# make install
 就OK了。
 ---------------------

或者干脆从源码重新编译一遍也可解决问题:(必须先编译yaml)

compiling from source for both yaml and ruby seems to resolve the issue.
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/yaml
make && make install

cd ~
(http://ftp.ruby-lang.org/pub/ruby/2.6/)
wget http://ftp.ruby-lang.org/pub/ruby/ruby-2.0-stable.tar.gz
tar xzvf ruby-2.0-stable.tar.gz
cd ruby-2.0.0-p*
 ./configure --prefix=/usr/local/ruby
make && make install 就行了。

I recommend doing the following to enable SSL support (only takes a few seconds):
  • cd ext/openssl
  • ruby extconf.rb
  • make && make install
And lastly, update the gem system:
  • sudo gem update --system
A little explanation for myself (and to others who are curious):
## recompiles yaml or any other module
cd ruby-2.0.0-p195/ext/<some module folder>
ruby extconf.rb
## reinstall Ruby
make && make install