因为项目需求,要更新闪验SDK,但是podsearch找不到最新的。于是升级cocoapods
坑1:
报错:zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory
解决方法:
终端输入:sudo gem install -n /usr/local/bin cocoapods
坑2:执行sudo gem install cocoapods
报错:ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
解决方案--执行:sudo gem install cocoapods -n /usr/local/bin
安装之后,podsearch
报错:[!] CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/all_pods_versions_1_8_7.txt, error: Net::OpenTimeout
删除~/Library/Caches/CocoaPods下的search_index.json文件
还是不行,podsearch会卡住,等了很久还是报错。
最后找到解决方案:
执行 sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer (-switch 后面加上你的Xcode.app包内容里的Developer的文件夹路径即可)
完美解决,希望能帮到大家。