how to solve “ruby installation is missing psych” error?

后端 未结 30 3207
悲哀的现实
悲哀的现实 2020-11-28 17:54

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

相关标签:
30条回答
  • 2020-11-28 18:47

    When I switch from 64 bit to 32 bit on Snow Leopard 10.6.8, I had reinstalled ruby (used rvm) to run on 32bit and met the same problem. So I just 'cleanup' all thing that cached by rvm before and problems solved. Hope this tip can help someone.

    rvm cleanup all

    rvm install ruby_version_here //(This way, rvm will also re-download newest yaml).

    BTW, if you still meet this problem, I think you can try:

    gem install psych

    0 讨论(0)
  • 2020-11-28 18:49

    None of these answers worked for me.

    I found my answer on https://github.com/sstephenson/ruby-build/issues/119 I am on Centos 6.3 Virtual Machine.

    YOU MUST install libyaml before you install ruby. IF you ALREADY installed ruby you must get rid of the files before compiling source again!!!

    # cd to your ruby source location
    rm -rf /usr/local/lib/ruby # clean out ruby files
    ./configure
    make && make install
    gem -v # check if error is fixed
    
    0 讨论(0)
  • 2020-11-28 18:49

    On CentOS 6.3 none of the above worked. However installing libyaml from source before installing ruby resolved the problem.

    $ 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
    $ sudo make install
    

    and then

    rvm install 1.9.3
    gem install rails
    
    0 讨论(0)
  • 2020-11-28 18:49

    NON-RVM ruby install method.

    % uname -a
    Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013  x86_64 x86_64 x86_64 GNU/Linux
    
    % cat /etc/redhat-release
    CentOS release 6.4 (Final)
    
    % wget http://apt.sw.be/redhat/el5/en/x86_64/dag/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
    % sudo rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm"
    % sudo rpm -ivh rpmforge-release-0.3.6-1.el5.rf.*.rpm"
    

    DISABLE rpmforge by editing this file and set enabled=0 % sudo vi /etc/yum.repos.d/rpmforge.repo

    % grep rpmforge ~/.aliases
    alias rpmforge "sudo yum --disablerepo='*' --enablerepo='rpmforge'"
    
    % rpmforge install libyaml libyaml-devel
    
    % sudo yum list installed | grep libyaml
    libyaml.x86_64          0.1.4-1.el5.rf  @rpmforge                               
    libyaml-devel.x86_64    0.1.4-1.el5.rf  @rpmforge  
    

    The libyaml-devel is the key.

    % tar zxvf ruby-1.9.3-p448.tar.gz
    % cd ruby-1.9.3-p448
    % ./configure -prefix=$HOME/ruby-1.9.3-p448
    % make ; make install
    % cd $HOME; ln -s ./ruby-1.9.3-p448 ruby
    

    Update your path and source .cshrc

    % echo $PATH
    /home/francis/ruby/bin:/usr/sbin:/home/francis/bin:/home/francis/jdk1.7.0_25/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin
    
    % which ruby
    /home/francis/ruby/bin/ruby
    
    % gem update --system
    

    Set your GEM_HOME in .cshrc and source

    % echo $GEM_HOME
    % /home/francis/ruby/lib/ruby/gems
    
    % gem install mysql2 pg ruby-debug-ide rails capistrano capistrano-ext passenger
    
    0 讨论(0)
  • 2020-11-28 18:50

    On Snow Leopard, the solution by Catharz did not work for me. This solution, however, did:

    brew install libyaml
    rvm get head
    rvm reinstall 1.9.3  --with-gcc=clang
    

    (The rvm reinstall gave me a warning about clang not having the option "--with-libyaml" but it solved the error message regardless.)

    0 讨论(0)
  • 2020-11-28 18:51
    sudo port install libyaml # or brew install libyaml
    rvm get latest
    rvm pkg install iconv
    rvm pkg install openssl
    rvm reinstall 1.9.3 --with-openssl-dir=~/.rvm/usr --with-iconv-dir=~/.rvm/usr
    
    curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
    curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
    
    gem install linecache19-0.5.13.gem ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$rvm_path/src/ruby-1.9.3-p125/
    gem install ruby-debug19
    
    rvm reload
    

    reload your .rvmrc (cd out, cd in)

    bundle
    
    0 讨论(0)
提交回复
热议问题