Xcode升级9.0版本后,CocoaPods遇到的问题

问题:Xcode升级为最新版本后pod无法集成?
具体情况如下:
当键入命令:sudo gem insta ll cocoapods 时,报错如下

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
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

提示为证书错误!
目前CocoaPods版本为1.0.1
淘宝镜像版本 ruby 2.0.0p648
经过网上查询资料,了解到这个问题的原因主要是Ruby环境需要2.2版本以上,所以要更新Ruby环境。
具体更新步骤如下:

  1. 首先要安装 Homebrew 终端输入这条
    命令即可
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. 安装rvm : $ curl -L get.rvm.io | bash -s stable
  3. 装载rvm : $ source ~/.rvm/scripts/rvm
  4. 安装2.3.0版本ruby : $ rvm install 2.3.0
  5. 将2.3.0设为默认 : $ rvm use 2.3.0 --default

当执行完第三步的命令后会出现一个警告

  • WARNING: You have '~/.profile' file, you might want to load it,
    to do that add the following line to '/Users/myname/.bash_profile':
    source ~/.profile

此时需要在本地前往文件路径到/Users/myname/.bash_profile

修改 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session as a function

source "$HOME/.profile" # Also loads RVM into a shell session as a function

当执行到第四步中的命令时出现了新的问题:

Updating system..........Failed to update Homebrew, follow instructions here:
https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure brew update works before continuing.
Error running 'requirements_osx_brew_update_system ruby-2.3.0',
please read /Users/Dengerxuan/.rvm/log/1506960095_ruby-2.3.0/update_system.log
Requirements installation failed with status: 1.

此时根据错误提示进行更新,执行命令

brew update

此处等待时间有点长,我差点以为自己命令执行的有问题
执行结束再次执行第四步的命令,有会出现问题:

Error running '__rvm_make -j 1',
please read /Users/Dengerxuan/.rvm/log/1506961671_ruby-2.3.0/make.log
There has been an error while running make. Halting the installation.

出现这样的情况,先安装xcode command line 即可解决

$ xcode-select --install

此时问题得到解决,但是终端会显示

Please be aware that you just installed a ruby that requires 3 patches just to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to ruby-2.4.1 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri

按照提示信息执行命令

rvm docs generate-ri

执行完成后执行第五步命令,问题得到解决。

关于错误证书问题:

$ cd $rvm_path/usr/ssl
$ sudo curl -O http://curl.haxx.se/ca/cacert.pem
$ sudo mv cacert.pem cert.pem

你可能感兴趣的:(Xcode升级9.0版本后,CocoaPods遇到的问题)