解决cocoaPods-pod install报错(-bash:

2020-07-13  本文已影响0人  xh_0129

问题

打算使用 CocoaPods 安装一些第三方库。当执行 pod install 命令时报如下错误:

-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

问题分析

可能Mac系统版本更新导致,那么重新安装镜像试一下

处理

1.首先执行如下命令查看所有 gem 源,检查是否是最新的:
gem sources -l

输出结果

*** CURRENT SOURCES ***
2.由于 RubyGems 镜像服务域名变更(后缀由之前的 org 改成 com),我们先执行如下命令将当前的 gem 源删除:
gem sources --remove https://gems.ruby-china.org/

输出结果

source https://gems.ruby-china.org/ not present in cache
3.添加新的 gem 源
gem sources -a https://gems.ruby-china.com

输出结果

https://gems.ruby-china.com added to sources

4.更新 gem
sudo gem update --system

输出结果

Latest version already installed. Done.
5.升级 CocoaPods
sudo gem install -n /usr/local/bin cocoapods --pre

输出结果

Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, activesupport, nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, cocoapods-trunk, cocoapods-try, molinillo, atomos, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 42 seconds
32 gems installed
6.更新本地仓库
pod repo update
7.执行 pod install 不再报错了。
pod install

输出结果

Pod installation complete! There are 5 dependencies from the Podfile and 5 total pods installed.
上一篇 下一篇

猜你喜欢

热点阅读