cocoapods pod install 报错

参考链接:https://stackoverflow.com/questions/22459944/ruby-2-1-1-with-rvm-getting-libyaml-errors

错误信息

今天在使用cocapods 更新第三方库的时候,出现了报错信息如下:

/Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.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/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/x86_64-darwin16/psych.bundle, 9): Library not loaded: /usr/local/opt/libyaml/lib/libyaml-0.2.dylib (LoadError)
  Referenced from: /Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/x86_64-darwin16/psych.bundle
  Reason: image not found - /Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/x86_64-darwin16/psych.bundle
    from /Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/psych.rb:8:in `'
    from /Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/BruceLv/.rvm/rubies/ruby-2.4.0-rc1/lib/ruby/2.4.0/yaml.rb:6:in `'

解决方式

根据报错的信息我们可以知道是libyaml 和 ruby的问题:
首先在命令行里输入:

brew install libyaml

显示信息如下:

cocoapods pod install 报错_第1张图片
然后检测是否安装成功:

brew info libyaml

显示信息如下:
这里写图片描述

最后

执行cocapod 命令

pod install

显示信息

cocoapods pod install 报错_第2张图片
解决方式:

pod repo update

cocoapods pod install 报错_第3张图片

然后就到此结束 又可以正常使用了。

你可能感兴趣的:(第三方库,iOS)