please install libyaml and reinstall your ruby

今天更新cocopods遇到下面这个错误,网上看看到了好多这种问题的,也有好多解决方法

/Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/yaml.rb:5:in `':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/x86_64-darwin16/psych.bundle, 9): Library not loaded: /Users/pipixia/wq/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
  Referenced from: /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/x86_64-darwin16/psych.bundle
  Reason: image not found - /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/x86_64-darwin16/psych.bundle
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/psych.rb:7:in `'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/2.3.0/yaml.rb:6:in `'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems.rb:700:in `load_yaml'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/config_file.rb:340:in `load_file'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/config_file.rb:202:in `initialize'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/gem_runner.rb:75:in `new'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/gem_runner.rb:75:in `do_configuration'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/gem_runner.rb:40:in `run'
    from /Users/pipixia/.rvm/rubies/ruby-2.3.3/bin/gem:21:in `
'

解决方法
一,首先更新ruby源到2.5.1以上
二,因为Ruby的软件源rubygems.org被屏蔽了,所以要更换源

> gem sources --add [https://gems.ruby-china.com/](https://gems.ruby-china.com/) --remove [https://rubygems.org/](https://rubygems.org/)

接下来查看下源路径是否更换了

gem sources -l

三,更新cocopods
接下来安装Cocoapods了

sudo gem install cocoapods

不过有可能出错(我就是出错了),出错的话执行下面的命令

sudo gem install -n /usr/local/bin cocoapods

四,查看cocopods版本

pod --version

大功告成!

你可能感兴趣的:(please install libyaml and reinstall your ruby)