美文网首页
Mac - CocoaPods 安装

Mac - CocoaPods 安装

作者: JamieChen | 来源:发表于2021-04-27 18:05 被阅读0次

检查

首先查看Mac中是否已经安装CocoaPods
终端输入pod update
示例:

work@bogon ~ % pod update
zsh: command not found: pod

前置环境安装

查看ruby 版本

终端输入ruby -v
示例:

work@bogon ~ % ruby -v
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]

若未安装ruby
示例:

work@bogon ~ % brew install ruby 
Warning: ruby 3.0.1 is already installed and up-to-date.
To reinstall 3.0.1, run:
  brew reinstall ruby

查看ruby源

终端输入gem sources -l
示例:

work@bogon ~ % gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/

国内推荐更换源
最新国内源:https://gems.ruby-china.com/
终端输入gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
示例:

work@bogon ~ % gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
https://gems.ruby-china.com/ added to sources
https://rubygems.org/ removed from sources

检查是否更换成功

work@bogon ~ % gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com/

安装
终端输入sudo brew install cocoapods 输入密码
示例:

work@bogon ~ % sudo gem install cocoapods
Password:
Fetching nanaimo-0.3.0.gem
*
*
*
Done installing documentation for nanaimo, colored2, claide, CFPropertyList, atomos, xcodeproj, ruby-macho, nap, molinillo, gh_inspector, fourflusher, escape, cocoapods-try, netrc, cocoapods-trunk, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, ffi, ethon, typhoeus, public_suffix, fuzzy_match, concurrent-ruby, httpclient, algoliasearch, addressable, thread_safe, tzinfo, i18n, activesupport, cocoapods-core, cocoapods after 18 seconds
34 gems installed
work@bogon ~ % 

终端输入pod setup
示例:

work@bogon ~ % pod setup
Setup completed

安装成功

相关文章

网友评论

      本文标题:Mac - CocoaPods 安装

      本文链接:https://www.haomeiwen.com/subject/updprltx.html