cocoapods安装失败

在安装cocoapods时提示:

YAML safe loading is not available.Please upgrade psych to version that supports safe loading(>=2.0)

查看本机支持的镜像

 gem --version

输出
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
2.6.14

sudo gem update --system  

YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Latest version currently installed. Aborting.

sudo gem uninstall psych 

YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
ERROR:  While executing gem ... (Gem::InstallError)
    gem "psych" cannot be uninstalled because it is a default gem

 sudo gem install psych -v 2.0.0

YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Fetching: psych-2.0.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing psych:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.0.0/gems/psych-2.0.0/ext/psych
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20180208-38574-b53zjl.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/psych-2.0.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/psych-2.0.0/gem_make.out

gem sources -l 

YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
*** CURRENT SOURCES ***

https://gems.ruby-china.org/

如果没有(http://gems.ruby-china.org/),没有的话,先删除其他的;

 gem sources --remove https://ruby.taobao.org/   
gem sources --remove https://rubygems.org/

添加http://gems.ruby-china.org/

gem sources -a http://gems.ruby-china.org/

然后执行


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


没有问题的话,正常会看到下面的提示,说明安装成功

24 gems installed


初始化cocoapods

pod setup

输出

pod setup
Setting up CocoaPods master repo
  $ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress
  Cloning into 'master'...
  remote: Counting objects: 1923580, done.        
  remote: Compressing objects: 100% (473/473), done.        
  remote: Total 1923580 (delta 208), reused 35 (delta 35), pack-reused 1923043        
  Receiving objects: 100% (1923580/1923580), 513.87 MiB | 1.16 MiB/s, done.
  Resolving deltas: 100% (1066616/1066616), done.
  Checking out files: 100% (215743/215743), done.
Setup completed





猜你喜欢

转载自blog.csdn.net/shubinniu/article/details/79293223