首頁 > uBuntu > It seems your ruby installation is missing psych.

It seems your ruby installation is missing psych.

2012年5月18日 發表評論 閱讀評論

莫名的,今天在裝 Ruby,然後要用 gem 時,出現一串訊息:

/usr/local/lib/ruby/1.9.1/yaml.rb:56: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.
Latest version currently installed. Aborting.

系統是Ubuntu 10.10,Ruby 是 ruby-1.9.3-p0

搜尋了網路之後得到一個比較好的解法:

$ sudo apt-get install libyaml-dev

然後重新安裝Ruby:

$ sudo apt-get install gcc libzlib-ruby libssl-dev libxslt-dev libxml2-dev libmemcached-dev libsasl2-dev libmemcached-dbg libpq-dev libcurl4-gnutls-dev

$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
$ tar zxvf ruby-1.9.3-p0.tar.gz
$ cd ruby-1.9.3-p0
$ ./configure
$ make
$ sudo make install

然後執行看看有沒有錯誤訊息:

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ gem -v
1.8.24

沒錯誤訊息就ok了

另外,最好啟用openssl一下:

$ cd ext/openssl
$ ruby extconf.rb
$ make
$ sudo make install

最後再更新一下gem:

$ sudo gem update --system

完成!!

補充移除舊的ruby方法:

$ whereis ruby
ruby: /usr/lib/ruby /usr/lib64/ruby /usr/local/bin/ruby /usr/local/lib/ruby
$ sudo rm -r /usr/lib/ruby
$ sudo rm -r /usr/lib64/ruby
$ sudo rm -r /usr/local/bin/ruby
$ sudo rm -r /usr/local/lib/ruby

參考來源:
Install Ruby 1.9.3 with libyaml on CentOS

How to Fix Ruby 1.9.3 “It seems your ruby installation is missing psych" Error

Installing Ruby 1.9 from Source on Ubuntu in Five Minutes

Categories: uBuntu Tags: ,
  1. 目前尚無任何的評論。