-
1.升级Ruby环境
sudo gem update --system
接下来会提示密文输入密码(直接输入密码就可以)
-
2.更换镜像
gem sources --remove https://rubygems.org/
移除现有镜像文件
更新镜像文件
gem source -a https://gems.ruby-china.org/
淘宝的已经不更新了,用国外的需要翻墙,这就很尴尬
查看镜像文件
gem sources -l
如果结果是
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
说明添加成功,否则继续执行$ gem source -a https://gems.ruby-china.org/来添加
-
3、安装CocoaPods
键入以下指令
sudo gem install cocoa pods
如果不行,执行下面这段
sudo gem install -n /usr/local/bin cocoapods
运行pod
pod setup
当出现 Setup completed 时说明已经完成
iOS "The sandbox is not in sync with the Podfile.lock"解决方案
rm -rf MyProject.xcworkspace
pod install
pod命令
Usage:
$ pod COMMAND
CocoaPods, the Cocoa library package manager.
Commands:
+ cache Manipulate the CocoaPods cache
+ deintegrate Deintegrate CocoaPods from your project
+ env Display pod environment
+ init Generate a Podfile for the current directory
+ install Install project dependencies according to versions from a
Podfile.lock
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
+ repo Manage spec-repositories
+ search Search for pods
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new
Podfile.lock
Options:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command