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

后端 未结 30 3209
悲哀的现实
悲哀的现实 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:44

    I also struggled with the same failures with rvm install ruby-2.0.0 for many, MANY hours. I had tried all the different methods to install libyaml; wget source, yum and rvm. I also tried all of the different approaches listed in similar threads. Because I tried all the different methods, I had multiple installations and locations of libyaml.

    RVM is perfectly capable of installing the necessary dependencies in ~/.rvm. Simply removing the libyaml files from non-RVM install fixed this issue for me:

    sudo rm /usr/local/lib/libyaml*.*
    
    rvm reinstall ruby-2.0.0-p0
    

    Works!

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

    I was having this error and noticed I had different versions of Ruby installed with HomeBrew, along with many gems that I no longer used. So did a full clean up like this:

    $ brew remove --force ruby # remove all versions installed
    $ sudo rm -rf /usr/local/lib/ruby # remove all gems and leftover files
    $ brew install ruby
    $ gem install bundler
    $ bundle install
    

    If you don't use a Gemfile, make sure you know which gems to reinstall.

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

    I got this fixed finally. The issue was that even though I installed libyaml with brew, it was never linked. I had to remove a conflicting header file and then brew link libyaml.

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

    for ubuntu and rvm

    sudo apt-get install libtool
    rvm pkg install libyaml
    rvm reinstall 1.9.3
    

    worked

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

    I had the same problem (Cent OS 5.7), none of the above solutions worked to me.

    // My console warning
    /usr/local/rvm/rubies/ruby-1.9.3-p286/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.
    

    After doing several re-installs, I realized it's looking for yaml in ruby version of 1.9.1 instead of 1.9.3. So i downgraded

    // obviously after installing `libyaml`
    rvm remove all
    rvm install 1.9.1
    rvm use 1.9.1 --default
    

    And it worked 8D!

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

    I'm using

    rvm 1.16.20 (version) by Wayne E. Seguin , Michal Papis [https://rvm.io/]

    and also got the following error during bundle install

    .rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `': It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.

    Here are three different ways to resolve this error w/o having to gem install psych

    1. export LD_LIBRARY_PATH=/usr/local/lib
    2. alter /etc/ld.so.conf

      sudo su - root
      echo /usr/local/lib64 >> /etc/ld.so.conf
      echo /usr/local/lib >> /etc/ld.so.conf
      ldconfig
      
    3. Fix rvm ruby 1.9.3 installation via

      patch .rvm/scripts/functions/manage/ruby < ruby-1.9.3-LDFLAGS.patch
      rvm uninstall ruby-1.9.3-p194
      export LDFLAGS='-L /usr/local/lib64 -L/usr/local/lib -Xlinker -R/usr/local/lib64 -Xlinker -R/usr/local/lib'
      rvm install ruby-1.9.3-p194 --disable-binary
      grep configure_args .rvm/src/ruby-1.9.3-p194/config.log # to confirm LDFLAG
      
        $ diff  -c .rvm/{src/rvm/,}scripts/functions/manage/ruby
        *** .rvm/src/rvm/scripts/functions/manage/ruby  2012-11-10 06:28:14.000000000 +0000
        --- .rvm/scripts/functions/manage/ruby  2013-01-25 17:18:00.000000000 +0000
        ***************
        *** 106,123 ****
                  # when relative is in effect libyaml is installed in ruby itself so it will be moved with ruby
                  prefix_path="${rvm_rubies_path}/${rvm_ruby_string}" libyaml
    
        !         __rvm_update_configure_env CFLAGS="-I${rvm_rubies_path}/${rvm_ruby_string}/include"
        !         __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib"
                  if [[ -d "${rvm_rubies_path}/${rvm_ruby_string}/lib64" ]]
        !         then __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib64"
                  fi
                else
                  libyaml_installed || libyaml # Installs libyaml
    
        !         __rvm_update_configure_env CFLAGS="-I${rvm_path}/usr/include"
        !         __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib"
                  if [[ -d "${rvm_path}/usr/lib64" ]]
        !         then __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib64"
                  fi
                fi
    
        --- 106,123 ----
                  # when relative is in effect libyaml is installed in ruby itself so it will be moved with ruby
                  prefix_path="${rvm_rubies_path}/${rvm_ruby_string}" libyaml
    
        !         __rvm_update_configure_env CFLAGS="-I${rvm_rubies_path}/${rvm_ruby_string}/include ${CFLAGS}"
        !         __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib ${LDFLAGS}"
                  if [[ -d "${rvm_rubies_path}/${rvm_ruby_string}/lib64" ]]
        !         then __rvm_update_configure_env LDFLAGS="-L${rvm_rubies_path}/${rvm_ruby_string}/lib64 ${LDFLAGS}"
                  fi
                else
                  libyaml_installed || libyaml # Installs libyaml
    
        !         __rvm_update_configure_env CFLAGS="-I${rvm_path}/usr/include ${CFLAGS}"
        !         __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib ${LDFLAGS}"
                  if [[ -d "${rvm_path}/usr/lib64" ]]
        !         then __rvm_update_configure_env LDFLAGS="-L${rvm_path}/usr/lib64 ${LDFLAGS}"
                  fi
                fi
    
    
    0 讨论(0)
提交回复
热议问题