很久不写 ios 代码,在老项目中使用$ pod install指令时,出现了[!] Oh no, an error occurred. 报错。
查版本:
pod --version
Ignoring ffi-1.9.25 because its extensions are not built. Try: gem pristine ffi --version 1.9.25
1.5.3
升级 gem:
sudo gem update --system
结果:
Updating rubygems-update
Fetching: rubygems-update-3.0.4.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
sudo gem update -n /usr/local/bin --system
结果
Updating rubygems-update
Successfully installed rubygems-update-3.0.4
Parsing documentation for rubygems-update-3.0.4
Installing ri documentation for rubygems-update-3.0.4
Installing darkfish documentation for rubygems-update-3.0.4
Done installing documentation for rubygems-update after 64 seconds
Parsing documentation for rubygems-update-3.0.4
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.0.4
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
升级 gem 进行不顺利,也搞不懂是什么原因,就直接升级 cocoapods吧。
sudo gem install -n /usr/local/bin cocoapods
Password:
Fetching fourflusher-2.3.1.gem
Fetching ruby-macho-1.4.0.gem
Fetching cocoapods-1.7.5.gem
Successfully installed xcodeproj-1.11.0
Successfully installed fourflusher-2.3.1
Successfully installed ruby-macho-1.4.0
Successfully installed cocoapods-1.7.5
Parsing documentation for xcodeproj-1.11.0
Installing ri documentation for xcodeproj-1.11.0
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
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 xcodeproj, fourflusher, ruby-macho, cocoapods after 9 seconds
4 gems installed
安装新版本之后:
pod --version
1.7.5
再 pod update 或者 pod install 的时候就不再报错啦。
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update