Cocoapods安装过程
1.升级Ruby环境
gem -v
gem update --system
如果没有权限去升级Ruby ?就输入
sudo gem update --system
2.换掉Ruby镜像
首先移除现有的Ruby镜像
gem sources --remove https://rubygems.org/
添加国内最新镜像源
gem source -a https://gems.ruby-china.org/
查看当前镜像
gem sources -l
3.安装CocoaPods
sudo gem install cocoapods
如果报错
sudo gem install -n /usr/local/bin cocoapods
4.初始化repos文件
pod repo add master https://github.com/CocoaPods/Specs.git
报错用这个
pod setup
5.安装过程中出现报错
报错类型1:
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress
Cloning into 'master'...
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': Could not resolve host: github.com
原因可能是:github.com没有被主机给解析
解决方法:在本地手动指定github.com的IP地址
编辑文件etc/hosts
sudo vi /etc/hosts
添加github的地址
::1 localhost
192.30.255.112 github.com
报错类型2:
[!] /usr/bin/git clone 'https://github.com/CocoaPods/Specs.git' master --depth=1
Cloning into 'master'...
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': Could not resolve host: github.com
原因可能是:安装多个Xcdoe,xcode路径问题
解决方法:sudo xcode-select -switch /Applications/Xcode.app/
在终端里输入下方命令可以知道Xcode的路径:
xcode-select -p
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· 分享4款.NET开源、免费、实用的商城系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了