赞
踩
通常我们做iOS移动端开发的,使用CocoaPods来管理第三方库。如果要更新第三方库,一般是在XCode工程所在目录下,执行pod install操作。
这一次我像往常一样去更像第三方库,但是出错了!!!
需要更像Cocoapods,旧的版本是1.4.0。我们要更新到1.7.5。
JamdeMBP:TestDemo jam$ pod install
Analyzing dependencies
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
/Users/jam/.rbenv/versions/2.1.0/bin/pod install
CocoaPods : 1.4.0
Ruby : ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin16.0]
RubyGems : 2.6.14
Host : Mac OS X 10.14.5 (18F132)
Xcode : 10.2.1 (10E1001)
Git : git version 2.20.1 (Apple Git-117)
Ruby lib dir : /Users/jam/.rbenv/versions/2.1.0/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ fe6fb4260eb8d5163e776f696b077c5853486112
cocoapods-deintegrate : 1.0.2
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
**解决问题的步骤:
1.更新CocoaPods
> 输入命令sudo gem update --system**
```bash
JamdeMBP:~ sudo gem update --system
Password:
Updating rubygems-update
Fetching: rubygems-update-3.0.4.gem (100%)
ERROR: Error installing rubygems-update:
rubygems-update requires Ruby version >= 2.3.0.
Installing RubyGems 2.6.14
RubyGems 2.6.14 installed
Parsing documentation for rubygems-2.6.14
Installing ri documentation for rubygems-2.6.14
=== 2.6.14 / 2017-10-09
Security fixes:
RubyGems installed the following executables:
/Users/jam/.rbenv/versions/2.1.0/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
> 【提示Ruby版本至少要>=2.30】 输入ruby -v查看一下当前ruby的版本号,果然是v2.1.0,那么下一步我们就要升级Ruby
JamdeMBP:~ jam$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin16.0]
> 【因为Mac OSX系统有自带Ruby,接下来查询一下当前的Ruby版本】
JamdeMBP:~ jam$ rvm list known
Warning! PATH is not properly set up, ‘/Users/jam/.rvm/gems/ruby-2.4.1/bin’ is not at first place.
Usually this is caused by shell initialization files. Search for ‘PATH=…’ entries.
You can also re-add RVM to your profile by running: ‘rvm get stable --auto-dotfiles’.
To fix it temporarily in this shell session run: ‘rvm use ruby-2.4.1’.
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Warning, new version of rvm available ‘1.29.9-next’, you are using older version ‘1.29.3’.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.7]
[ruby-]2.3[.4]
[ruby-]2.4[.1]
ruby-head
jruby-1.6[.8]
jruby-1.7[.27]
jruby[-9.1.13.0]
jruby-head
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.84]
rbx-head
opal
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1[.3.0]
mruby[-head]
ree-1.8.6
ree[-1.8.7][-2012.02]
topaz
maglev[-head]
maglev-1.0.0
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head
ironruby[-1.1.3]
ironruby-head
**
> 【接下来,咱一步一步来,先来安装一下RVM】
**
JamdeMBP:~ jam$ curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 194 100 194 0 0 140 0 0:00:01 0:00:01 --:–:-- 140
100 24535 100 24535 0 0 4324 0 0:00:05 0:00:05 --:–:-- 5924
Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc
Found PGP signature at: ‘https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc’,
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/jam/.rvm/
RVM PATH line found in /Users/jam/.mkshrc /Users/jam/.profile /Users/jam/.bashrc /Users/jam/.zshrc.
RVM sourcing line found in /Users/jam/.profile /Users/jam/.bash_profile /Users/jam/.zlogin.
Upgrade of RVM in /Users/jam/.rvm/ is complete.
Thanks for installing RVM
Please consider donating to our open collective to help us maintain RVM.
Donate: https://opencollective.com/rvm/donate
刷新当前终端的环境变量
JamdeMBP:~ jam$ source ~/.bashrc
JamdeMBP:~ jam$ source ~/.bash_profile
```bash
JamdeMBP:~ jam$ rvm install 2.3.0
RVM version 1.29.9 (latest) is installed yet 1.29.3 (latest) is loaded.
Please do one of the following:
JamdeMBP:~ jam$ echo rvm_auto_reload_flag=1 >> ~/.rvmrc
JamdeMBP:~ jam$ rvm install 2.3.0
RVM reloaded!
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.3.0.
Continuing with compilation. Please read ‘rvm help mount’ to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system…
Installing required packages: zlib…
==> Upgrading 6 outdated packages:
automake 1.16.1 -> 1.16.1_1, coreutils 8.29 -> 8.31, libyaml 0.1.7 -> 0.2.2, openssl 1.0.2p -> 1.0.2s, openssl@1.1 1.1.0g_1 -> 1.1.1c, readline 7.0.5 -> 8.0.0_1
==> Upgrading openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2s.mojave.bottle.tar
==> Downloading from https://akamai.bintray.com/c4/c4a762d719c2be74ac686f1aafabb32f3c
######################################################################## 100.0%
==> Pouring openssl-1.0.2s.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
openssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have openssl first in your PATH run:
echo ‘export PATH="/usr/local/opt/openssl/bin:$PATH"’ >> ~/.bash_profile
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
==> Summary
/usr/local/Cellar/openssl/1.0.2s: 1,795 files, 12.0MB
Removing: /usr/local/Cellar/openssl/1.0.2l… (1,709 files, 12.2MB)
Removing: /usr/local/Cellar/openssl/1.0.2o_1… (1,791 files, 12.3MB)
Removing: /usr/local/Cellar/openssl/1.0.2o_2… (1,792 files, 12.3MB)
Removing: /usr/local/Cellar/openssl/1.0.2p… (1,793 files, 12.3MB)
==> Upgrading openssl@1.1
==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1c.mojave.bottle
==> Downloading from https://akamai.bintray.com/e4/e4c85922978ded43321679e00ecb35b47d
######################################################################## 100.0%
==> Pouring openssl@1.1-1.1.1c.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don’t link an incompatible version.
If you need to have openssl@1.1 first in your PATH run:
echo ‘export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"’ >> ~/.bash_profile
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
==> Summary
/usr/local/Cellar/openssl@1.1/1.1.1c: 7,963 files, 17.9MB
Removing: /usr/local/Cellar/openssl@1.1/1.1.0g_1… (6,585 files, 15.6MB)
==> Upgrading readline
==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.0_1.mojave.bottle.t
==> Downloading from https://akamai.bintray.com/fa/faab004773e6449dd97971311cb62a9bba
######################################################################## 100.0%
==> Pouring readline-8.0.0_1.mojave.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
For compilers to find readline you may need to set:
export LDFLAGS="-L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/readline/include"
For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"
==> Summary
/usr/local/Cellar/readline/8.0.0_1: 48 files, 1.5MB
Removing: /usr/local/Cellar/readline/7.0.3_1… (46 files, 1.5MB)
Removing: /usr/local/Cellar/readline/7.0.5… (46 files, 1.5MB)
==> Upgrading automake
==> Downloading https://homebrew.bintray.com/bottles/automake-1.16.1_1.mojave.bottle.
==> Downloading from https://akamai.bintray.com/0a/0a359c2385d0673ce1ab3cdaf39dd22af1
######################################################################## 100.0%
==> Pouring automake-1.16.1_1.mojave.bottle.tar.gz
/usr/local/Cellar/automake/1.16.1_1: 131 files, 3.4MB
Removing: /usr/local/Cellar/automake/1.16… (131 files, 3MB)
Removing: /usr/local/Cellar/automake/1.16.1… (131 files, 3MB)
==> Upgrading coreutils
==> Downloading https://homebrew.bintray.com/bottles/coreutils-8.31.mojave.bottle.tar
==> Downloading from https://akamai.bintray.com/f1/f11898e59abf1c9ea9807ab15c7cdfc930
######################################################################## 100.0%
==> Pouring coreutils-8.31.mojave.bottle.tar.gz
==> Caveats
Commands also provided by macOS have been installed with the prefix “g”.
If you need to use these commands with their normal names, you
can add a “gnubin” directory to your PATH from your bashrc like:
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
==> Summary
/usr/local/Cellar/coreutils/8.31: 476 files, 8.8MB
Removing: /usr/local/Cellar/coreutils/8.29… (430 files, 8.9MB)
==> Upgrading libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.2.2.mojave.bottle.tar.
######################################################################## 100.0%
==> Pouring libyaml-0.2.2.mojave.bottle.tar.gz
/usr/local/Cellar/libyaml/0.2.2: 9 files, 291.6KB
Removing: /usr/local/Cellar/libyaml/0.1.7… (8 files, 312.6KB)
==> Upgrading 7 dependents:
ios-webkit-debug-proxy HEAD-a4ed446 -> HEAD-a4ed446, python@2 2.7.15 -> 2.7.16, libxml2 2.9.7 -> 2.9.9_2, python 3.7.1 -> 3.7.4, rbenv 1.1.1 -> 1.1.2, ruby-build 20180618 -> 20190615, sqlite 3.25.3 -> 3.29.0
==> Upgrading libxml2
==> Installing dependencies for libxml2: sqlite and python
==> Installing libxml2 dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.29.0.mojave.bottle.tar.
==> Downloading from https://akamai.bintray.com/5f/5f2f8f36a8d13733b0374ac39bdcd32dea
######################################################################## 100.0%
==> Pouring sqlite-3.29.0.mojave.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.
If you need to have sqlite first in your PATH run:
echo ‘export PATH="/usr/local/opt/sqlite/bin:$PATH"’ >> ~/.bash_profile
For compilers to find sqlite you may need to set:
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
For pkg-config to find sqlite you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"
==> Summary
/usr/local/Cellar/sqlite/3.29.0: 11 files, 3.9MB
==> Installing libxml2 dependency: python
Error: Xcode alone is not sufficient on Mojave.
Install the Command Line Tools:
xcode-select --install
Requirements installation failed with status: 1.
> 天哪,又出错了,Requirements installation failed with status: 1.怎么办?Don’t worry! 解决办法如下: 按照上面给的提示在终端命令行里输入:
JamdeMBP:~ xcode-select --install
然后再输入rvm install 2.3.0
JamdeMBP:~ rvm install 2.3.0
安装完之后,查看cocoapods版本
JamdeMBP:~ jam$ pod --version
1.4.0
查看路径
JamdeMBP:~ jam$ which pod
/Users/jam/.rbenv/shims/pod
重新安装
JamdeMBP:~ sudo gem install cocoapods
Password:
Successfully installed cocoapods-1.7.5
Parsing documentation for cocoapods-1.7.5
Done installing documentation for cocoapods after 4 seconds
1 gem installed
再次查看cocoapods版本还是1.4.0,额(⊙o⊙)…搞什么,懵逼了?别急……
```bash JamdeMBP:~ jam$ pod --version 1.4.0 JamdeMBP:~ jam$ rvm -v Warning! PATH is not properly set up, /Users/jam/.rvm/gems/ruby-2.4.1/bin is not at first place. Usually this is caused by shell initialization files. Search for PATH=... entries. You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles To fix it temporarily in this shell session run: rvm use ruby-2.4.1 To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file. rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] Warning! PATH is not properly set up, /Users/jam/.rvm/gems/ruby-2.4.1/bin is not at first place. Usually this is caused by shell initialization files. Search for PATH=... entries. You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles To fix it temporarily in this shell session run: rvm use ruby-2.4.1 To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file. Using /Users/jam/.rvm/gems/ruby-2.4.1 JamdeMBP:~ jam$ rvm -v rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io] JamdeMBP:~ jam$ rvm use ruby-2.4.1 Using /Users/jam/.rvm/gems/ruby-2.4.1 JamdeMBP:~ jam$ rvm -v rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
制定完rvm版本后,重新输入sudo gem install cocoapods
JamdeMBP:~ jam$ sudo gem install cocoapods Fetching: thread_safe-0.3.6.gem (100%) Successfully installed thread_safe-0.3.6 Fetching: tzinfo-1.2.5.gem (100%) Successfully installed tzinfo-1.2.5 Fetching: concurrent-ruby-1.1.5.gem (100%) Successfully installed concurrent-ruby-1.1.5 Fetching: i18n-0.9.5.gem (100%) Successfully installed i18n-0.9.5 Fetching: activesupport-4.2.11.1.gem (100%) Successfully installed activesupport-4.2.11.1 Fetching: nap-1.1.0.gem (100%) Successfully installed nap-1.1.0 Fetching: fuzzy_match-2.0.4.gem (100%) Successfully installed fuzzy_match-2.0.4 Fetching: cocoapods-core-1.7.5.gem (100%) Successfully installed cocoapods-core-1.7.5 Fetching: claide-1.0.2.gem (100%) Successfully installed claide-1.0.2 Fetching: cocoapods-deintegrate-1.0.4.gem (100%) Successfully installed cocoapods-deintegrate-1.0.4 Fetching: cocoapods-downloader-1.2.2.gem (100%) Successfully installed cocoapods-downloader-1.2.2 Fetching: cocoapods-plugins-1.0.0.gem (100%) Successfully installed cocoapods-plugins-1.0.0 Fetching: cocoapods-search-1.0.0.gem (100%) Successfully installed cocoapods-search-1.0.0 Fetching: cocoapods-stats-1.1.0.gem (100%) Successfully installed cocoapods-stats-1.1.0 Fetching: netrc-0.11.0.gem (100%) Successfully installed netrc-0.11.0 Fetching: cocoapods-trunk-1.3.1.gem (100%) Successfully installed cocoapods-trunk-1.3.1 Fetching: cocoapods-try-1.1.0.gem (100%) Successfully installed cocoapods-try-1.1.0 Fetching: molinillo-0.6.6.gem (100%) Successfully installed molinillo-0.6.6 Fetching: atomos-0.1.3.gem (100%) Successfully installed atomos-0.1.3 Fetching: CFPropertyList-3.0.0.gem (100%) Successfully installed CFPropertyList-3.0.0 Fetching: colored2-3.1.2.gem (100%) Successfully installed colored2-3.1.2 Fetching: nanaimo-0.2.6.gem (100%) Successfully installed nanaimo-0.2.6 Fetching: xcodeproj-1.11.0.gem (100%) Successfully installed xcodeproj-1.11.0 Fetching: escape-0.0.4.gem (100%) Successfully installed escape-0.0.4 Fetching: fourflusher-2.3.1.gem (100%) Successfully installed fourflusher-2.3.1 Fetching: gh_inspector-1.1.3.gem (100%) Successfully installed gh_inspector-1.1.3 Fetching: ruby-macho-1.4.0.gem (100%) Successfully installed ruby-macho-1.4.0 Fetching: cocoapods-1.7.5.gem (100%) Successfully installed cocoapods-1.7.5 Parsing documentation for thread_safe-0.3.6 Installing ri documentation for thread_safe-0.3.6 Parsing documentation for tzinfo-1.2.5 Installing ri documentation for tzinfo-1.2.5 Parsing documentation for concurrent-ruby-1.1.5 Installing ri documentation for concurrent-ruby-1.1.5 Parsing documentation for i18n-0.9.5 Installing ri documentation for i18n-0.9.5 Parsing documentation for activesupport-4.2.11.1 Installing ri documentation for activesupport-4.2.11.1 Parsing documentation for nap-1.1.0 Installing ri documentation for nap-1.1.0 Parsing documentation for fuzzy_match-2.0.4 Installing ri documentation for fuzzy_match-2.0.4 Parsing documentation for cocoapods-core-1.7.5 Installing ri documentation for cocoapods-core-1.7.5 Parsing documentation for claide-1.0.2 Installing ri documentation for claide-1.0.2 Parsing documentation for cocoapods-deintegrate-1.0.4 Installing ri documentation for cocoapods-deintegrate-1.0.4 Parsing documentation for cocoapods-downloader-1.2.2 Installing ri documentation for cocoapods-downloader-1.2.2 Parsing documentation for cocoapods-plugins-1.0.0 Installing ri documentation for cocoapods-plugins-1.0.0 Parsing documentation for cocoapods-search-1.0.0 Installing ri documentation for cocoapods-search-1.0.0 Parsing documentation for cocoapods-stats-1.1.0 Installing ri documentation for cocoapods-stats-1.1.0 Parsing documentation for netrc-0.11.0 Installing ri documentation for netrc-0.11.0 Parsing documentation for cocoapods-trunk-1.3.1 Installing ri documentation for cocoapods-trunk-1.3.1 Parsing documentation for cocoapods-try-1.1.0 Installing ri documentation for cocoapods-try-1.1.0 Parsing documentation for molinillo-0.6.6 Installing ri documentation for molinillo-0.6.6 Parsing documentation for atomos-0.1.3 Installing ri documentation for atomos-0.1.3 Parsing documentation for CFPropertyList-3.0.0 Installing ri documentation for CFPropertyList-3.0.0 Parsing documentation for colored2-3.1.2 Installing ri documentation for colored2-3.1.2 Parsing documentation for nanaimo-0.2.6 Installing ri documentation for nanaimo-0.2.6 Parsing documentation for xcodeproj-1.11.0 Installing ri documentation for xcodeproj-1.11.0 Parsing documentation for escape-0.0.4 Installing ri documentation for escape-0.0.4 Parsing documentation for fourflusher-2.3.1 Installing ri documentation for fourflusher-2.3.1 Parsing documentation for gh_inspector-1.1.3 Installing ri documentation for gh_inspector-1.1.3 Parsing documentation for ruby-macho-1.4.0 Installing ri documentation for ruby-macho-1.4.0 Parsing documentation for cocoapods-1.7.5 Installing ri documentation for cocoapods-1.7.5 Done installing documentation for thread_safe, tzinfo, concurrent-ruby, i18n, activesupport, nap, fuzzy_match, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, netrc, cocoapods-trunk, cocoapods-try, molinillo, atomos, CFPropertyList, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 22 seconds 28 gems installed
最后,黎明的曙光终于来临!!!再次输入pod --version查看版本号
JamdeMBP:~ jam$ pod --version
1.7.5
然后重新去工程的路径下
```bash
JamdeMBP:~ jam$ pod install
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。