这儿我们使用homebrew来安装
首先安装homebrew,将下句放入命令行运行
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
然后根据上句安装完后提示配置(共两个命令语句)
- Run these two commands in your terminal to add Homebrew to your PATH:(echo; echo 'eval "(/opt/homebrew/bin/brew shellenv)"- Run brew help to get started- Further documentation: https://docs.brew.sh
然后根据提示分别执行
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/你的电脑名/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
然后执行
brew install cocoapods
完了执行
pod setup
然后新项目pod
cd 你的项目
pod init
vim Podfile
然后podfile文件第一行加上:source'https://github.com/CocoaPods/Specs.git'
然后 pod install可以看成功没(第一次pod会比较慢,耐心等待)