MacOS 10.11.6 下 更新CocoaPods 遇到的坑

    xiaoxiao2021-03-25  89

    由于部分swift3.0的框架需要 CocoaPods 1.1.0 以上才支持,以前使用的是淘宝的镜像,但是只能升到 1.0.1版本,接下来就开始了苦逼的CocoaPods更新之路~~~

    1.由于以前使用的淘宝源不再更新,先替换 镜像源

    gem sources –remove https://ruby.taobao.org/ gem sources -a https://gems.ruby-china.org

    2.验证是否 替换成功 gem source -l

    成功后:

    localhost:~ elion$ gem source -l * CURRENT SOURCES *

    https://gems.ruby-china.org

    3.升级 cocoa pods

    sudo gem install -n /usr/local/bin cocoa pods 或 sudo gem install cocoapods

    结果报错

    ERROR: While executing gem … (Gem::DependencyError) Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.2.0), cocoapods-downloader (< 2.0, >= 1.1.3), cocoapods-trunk (< 2.0, >= 1.1.2), molinillo (~> 0.5.5), xcodeproj (< 2.0, >= 1.4.1), fourflusher (~> 2.0.1), gh_inspector (~> 1.0), ruby-macho (~> 0.2.5)

    4.解决上面错误

    a. 查了网上有文章说最好先把 先前的cocoapods 卸载 sudo gem uninstall -n /usr/local/bin cocoapods b.查看本地安装过的cocoa pods的相关东西 gem list —local | grep cocoapods 会显示如下 cocoapods-core (1.0.1) cocoapods-downloader (0.9.3) cocoapods-plugins (0.4.2) cocoapods-search (0.1.0) cocoapods-stats (0.6.2) cocoapods-trunk (0.6.4) cocoapods-try (0.5.1) 使用命令逐条删除 sudo gem uninstall -n /usr/local/bin cocoapods-core sudo gem uninstall -n /usr/local/bin cocoapods-downloader …… …

    完事后开始更新 ruby sudo gem update –system 输入密码后 会有大串输出

    Updating rubygems-update Fetching: rubygems-update-2.6.7.gem (100%) Successfully installed rubygems-update-2.6.7 Parsing documentation for rubygems-update-2.6.7 Installing ri documentation for rubygems-update-2.6.7 Installing darkfish documentation for rubygems-update-2.6.7 Installing RubyGems 2.6.7 RubyGems 2.6.7 installed Parsing documentation for rubygems-2.6.7 Installing ri documentation for rubygems-2.6.7

    === 2.6.7 / 2016-09-26

    Bug fixes:

    Install native extensions in the correct location when using the --user-install flag. Pull request #1683 by Noah Kantrowitz.When calling Gem.sources, load sources from 。。。。。。。 。。。。。。 。。。。。 。。。。 。。。 。。

    RubyGems installed the following executables: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/gem

    Ruby Interactive (ri) documentation was installed. ri is kind of like man pages for ruby libraries. You may access it like this: ri Classname ri Classname.class_method ri Classname#instance_method If you do not wish to install this documentation in the future, use the –no-document flag, or set it as the default in your ~/.gemrc file. See ‘gem help env’ for details. RubyGems system software updated

    如果有报错

    ERROR: While executing gem … (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj

    终端输入: sudo nvram boot-args=”rootless=0” sudo reboot 电脑会重启 重启后再次执行 步骤 4

    5. ruby更新完成之后执行 sudo gem install cocoapods -V

    cocoapods安装成功

    localhost:bin elion$ sudo gem install cocoapods -V Getting SRV record failed: DNS result has no information for _rubygems._tcp.gems.ruby-china.org HEAD https://gems.ruby-china.org/api/v1/dependencies 200 OK GET https://gems.ruby-china.org/api/v1/dependencies?gems=cocoapods 200 OK 。。。。。。。 。。。。。。 。。。。。 。。。。 。。。 。。 100% [111/111] lib/cocoapods/validator.rb Installing ri documentation for cocoapods-1.2.0 16 gems installed

    6.查看 Cocoapods 版本

    pod –version

    localhost:bin elion$ pod –version 1.2.0

    转载请注明原文地址: https://ju.6miu.com/read-22599.html

    最新回复(0)