iOS Cocoapods更新,pod update 失败

2018.03.18 18:21:34字数 391阅读 1151

最近公司开始新的项目,然后就开始搭建项目。在使用CocoaPods的时候碰到一些使用问题。查阅一些资料,整理了一下。

在2018.02.23以后, Mac默认的Ruby运行环境下,在终端执行pod setup或pod update时会有如下报错

 -- [!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down

原因:weak-cryptographic-standards-removed

https://blog.github.com/2018-02-23-weak-cryptographic-standards-removed/

这样我们就需要更新openssl、Ruby以及CocoaPods。在终端输入如下代码

$ which openssl

/usr/bin/openssl

$ openssl version

OpenSSL 0.9.8zh 14 Jan 2016

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

$ brew update

$ brew install openssl

$ brew upgrade openssl

$ echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

$ source ~/.bash_profile

$ which openssl

/usr/local/opt/openssl/bin/openssl

$ openssl version

OpenSSL 1.0.2n  7 Dec 2017

$ brew install rbenv ruby-build

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile

$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile

$ source ~/.bash_profile

$ rbenv install --list

Available versions:

  1.8.5-p52

  1.8.5-p113

  1.8.5-p114

    ...

  2.5.0-rc1

  2.5.0

  2.6.0-dev

$ rbenv install 2.5.0

$ rbenv versions

* system (set by /Users/username/.rbenv/version)

  2.5.0

$ ruby --version

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

$ rbenv global 2.5.0

$ rbenv versions

  system

* 2.5.0 (set by /Users/username/.rbenv/version)

$ ruby --version

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]

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

$ which pod

/usr/local/bin/pod

$ pod --version

1.4.0

这些确认完毕,再执行:

$ pod update

等待更新完成。

 

参考资料:ttps://qiita.com/satoshi-iwaki/items/ed2c267127dcc80baa21

 

 

 

homebrew安装

安装

已废弃

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

 

git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

 

brew doctor

 

国内镜像

https://www.cnblogs.com/beyondmch/articles/8331478.html

https://www.jianshu.com/p/dee2e61dcb70

 

设置国外镜像

git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew

git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://github.com/Homebrew/homebrew-core

 

cocopods安装

安装cocopods参考

https://www.jianshu.com/p/c2f9491485ec

 国外镜像

https://rubygems.org/

 

 

1.卸载老版本cocopods

which pod

得到pod的路径

sudo rm -rf <pod的路径>

$ sudo gem uninstall cocoapods

2.查看本地安装过的cocopods相关东西

$ gem list --local | grep cocoapods

显示如下:

cocoapods (1.0.1)

cocoapods-core (1.0.1)

cocoapods-deintegrate (1.0.1)

cocoapods-downloader (1.1.1)

cocoapods-plugins (1.0.0)

cocoapods-search (1.0.0)

cocoapods-stats (1.0.0)

cocoapods-trunk (1.0.0)

cocoapods-try (1.1.0)

然后使用命令逐个删除

$ sudo gem uninstall cocoapods-core

$ sudo gem uninstall cocoapods-deintegrate

 

posted @ 2019-10-15 13:06  sundayswift  阅读(451)  评论(0)    收藏  举报