程序员

iOS – 解决Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named

pod[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master`.You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

解决方案:

pod repo add master https://github.com/CocoaPods/Specs.git
然后提示执行’pod setup’

如果出现
pod[!] The `master` repo is not a git repo.
进入/users/你的用户名/.cocoapods/repos,删除master文件夹然后执行
pod setup
如果是安装多个Xcdoe,还需要选择Xcode的路径
sudo xcode-select -switch /Applications/Xcode.app/
在终端里输入下方命令可以知道Xcode的路径:
xcode-select -p