最近由于换了新工作,然后公司给配了新电脑,项目开始之前,打算配置一下CocoaPods,然后在更换Ruby镜像:gem sources --add https://gems.ruby-china.org/的时候,一直报Error fetching https://gems.ruby-china.org/:
bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)的错误,目前网上很多博客啊什么的都是直接用org后缀的镜像,其实Ruby镜像域名已经更换成https://gems.ruby-china.com了,

所以,更换一下域名就可以了,接下来就是安装搜索一系列操作了。
添加一下具体步骤
1、升级Ruby环境$ sudo gem update --system
2、更换Ruby镜像
首先输入gem sources -l来查看当前镜像
然后移除现有的Ruby镜像
终端输入:$gem sources -a https://gems.ruby-china.com添加镜像
执行完毕之后输入gem sources -l来查看当前镜像是否成功添加
3、安装
$ sudo gem install -n /usr/local/bin cocoapods(用sudo gem install cocoapods可能会提示你没有权限)
4、创建Podfile文件
先cd 到你的工程目录,然后touch Podfile创建一个Podfile文件,最后vim Podfile编辑,也可以在目录下直接打开Podfile文件编辑

如果是vim Podfile的话,然后按左上角的esc键,再按:键,再输入wq,点击回车,就保存并退出去了。
最后$pod install安装之后就可以使用了,注意在没创建Podfile文件之前我们打开Xcode是打开后缀为xcodeproj的工程的,装完Podfile文件之后我们就需要打开下面那个workspace文件了。

网友评论