更换电脑后,记录一下重新安装cocoapods
删除原有镜像
gem sources --remove rubygems.org/
新增
gem sources -a gems.ruby-china.com/
查看是否成功
gem source -l
*** CURRENT SOURCES ***
默认ruby版本2.6.0,需要更新
1.brew install rbenv
顺序执行
brew install rbenv
brew install ruby-build
添加 rbenv 到 shell 依次执行
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.zshrc
source ~/.zshrc
安装ruby版本
rbenv install 3.1.2
全局配置
rbenv global 3.1.2
// 终端执行
ruby -v
// 执行结果如下:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin24]
2.安装cocoapods
安装pods
sudo gem install cocoapods
显示如下就ok了
Installing ri documentation for cocoapods-1.16.2
Done installing documentation for rexml, 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, tzinfo, securerandom, i18n, connection_pool, benchmark, activesupport, cocoapods-core, cocoapods after 7 seconds
37 gems installed