The problem
Installing a Ruby gem with gem install on Red Hat® Enterprise Linux 6.8 returns errors indicating problems with libyaml:
gem install bundler
/usr/local/lib/ruby/1.9.1/yaml.rb:84:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
The investigation
Trying to reinstall libyaml and libyaml-devel followed by a reinstall of ruby did not solve the issue.
The solution
After investigating this issue for a while, and not able to solve it through yum, I considered to either install and use rvm for this, or to download and compile the source. I found http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/ where the author had good success with the latter, so I did the same, but cleaning up all by Ruby and libyaml stuff from yum first:
yum remove -y ruby libyaml libyaml-devel rubygem-rake rubygems rubygems-devel
# Download and install libyaml
cd /tmp
wget http://pyyaml.org/download/libyaml/yaml-0.1.7.tar.gz
tar xzvf yaml-0.1.7.tar.gz
cd yaml-0.1.7
./configure --prefix=/usr/local
make
make install
# Download and install Ruby
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
tar xzvf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
make install
wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
tar xzvf ruby-2.3.1.tar.gz
cd ruby-2.3.1
./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
make install
# Install your gems
gem install bundler
No comments:
Post a Comment