ruby的版本号:
https://gorails.com/setup/osx/10.12-sierra
更新ruby、gem
1.安装Homebrew
http://brew.sh/index_zh-cn.html
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安装rvm
https://rvm.io/rubies/installing
2.1.安装rvm$ curl -L get.rvm.io | bash -s stable
2.2.装载rvm$ source ~/.rvm/scripts/rvm
2.3 安装xcode命令行
xcode-select --install
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
2.4.安装2.3.0版本ruby$ rvm install 2.3.3
2.5.将2.3.0设为默认$ rvm use 2.3.3 --default
3.因为cocoaPods需要用Gem进行安装,所以如果系统比较旧需要先升级Gem
sudo gem update --system
4.sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods
While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
sudo chmod 777 /Library/Ruby/Gems/2.0.0
2.查看数据源
gem sources -l
3.移除与添加。只保证只有ruby这个源。
gem sources --remove http://ruby.taobao.org/
gem sources -a https://gems.ruby-china.org/
2. 执行 pod update 遇到问题
出现:Performing a deep fetch of themasterspecs repo to improve future performance
解决方案: 删除索引库,重新安装Pod,执行终端命令
rm -rf ~/.cocoapods/repos
pod setup
cd ~/.cocoapods/
du -sh * 【查看正在下载的文件夹的大小】
3.执行pod repo update更新本地仓库
比较不卡顿。偶尔会比较慢,耐心等待一下。
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update