关于macOs13安装cocoapods的流程记录

前景提要:

电脑重装系统辣,导致电脑之前安装的ruby环境以及cocoapods等其他相关环境全都没了,所以都需要重新整了,踩了好多坑,所以打算记录下来,下次可别这么折磨人了,也希望有相同问题的小伙伴少走一些弯路。之前踩坑错误的流程我就不总结了,直接贴从头到脚无痛顺利安装cocoapods的过程!!
*还有我是重装系统,所以当前系统无之前相关版本,都是重新安装的

第一步,安装命令行工具

终端输入:

 xcode-select –install

第二步,安装homebrew

详参此链接:Mac系统HomeBrew安装过程

第三步,安装ruby环境

1.终端执行这句指令:

brew install ruby

2.如果终端出现以下内容说明安装成功,但是还需要下一步设置路径问题

截屏2023-08-08 20.53.20.png

3.下一步配置路径问题,在终端输入以下内容:

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

4.然后终端输入以下内容,

ruby --version

5.可以查看到ruby的版本号就说明安装成功了
截屏2023-08-08 21.01.06.png

6.然后关闭终端,重启

第四步,更换ruby为国内镜像

1.先查看当前系统的ruby环境,在终端输入以下内容

gem sources -l

2.默认环境是(我没记错的话,因为我的已经是更换过的了)

*** CURRENT SOURCES ***
https://rubygems.org

3.先将系统中默认的ruby环境移除,在终端输入以下内容:

gem source -r https://rubygems.org

4.然后添加国内镜像,终端继续输入:

gem source -a https://gems.ruby-china.com

5.然后终端再输入:gem sources -l,出现以下内容就ok了


截屏2023-08-08 21.48.41.png

6.终于可以下一步了,累鼠了。。

第五步,终于可以开始安装cocoapods辣!

1.终端输入:

gem install cocoapods --user-install  

2.然后会出现以下内容:

WARNING: You don't have /Users/你的电脑用户名/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run.
Successfully installed rexml-3.2.6
Successfully installed nanaimo-0.3.0
Successfully installed colored2-3.1.2
Successfully installed claide-1.1.0
Successfully installed atomos-0.1.3
Successfully installed xcodeproj-1.22.0
Successfully installed ruby-macho-2.5.1
Successfully installed nap-1.1.0
Successfully installed molinillo-0.8.0
Successfully installed gh_inspector-1.1.3
Successfully installed fourflusher-2.3.1
Successfully installed escape-0.0.4
Successfully installed cocoapods-try-1.2.0
Successfully installed netrc-0.11.0
Successfully installed cocoapods-trunk-1.6.0
Successfully installed cocoapods-search-1.0.1
Successfully installed cocoapods-plugins-1.0.0
Successfully installed cocoapods-downloader-1.6.3
Successfully installed cocoapods-deintegrate-1.0.5
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Successfully installed ethon-0.16.0
Successfully installed typhoeus-1.4.0
Successfully installed public_suffix-4.0.7
Successfully installed fuzzy_match-2.0.4
Successfully installed concurrent-ruby-1.2.2
Building native extensions. This could take a while...
Successfully installed json-2.6.3
Successfully installed httpclient-2.8.3
A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Successfully installed addressable-2.8.5
Successfully installed zeitwerk-2.6.11
Successfully installed tzinfo-2.0.6
Successfully installed minitest-5.19.0
Successfully installed i18n-1.14.1
Successfully installed activesupport-6.1.7.4
Successfully installed cocoapods-core-1.12.1
Successfully installed cocoapods-1.12.1
Parsing documentation for rexml-3.2.6
Installing ri documentation for rexml-3.2.6
Parsing documentation for nanaimo-0.3.0
Installing ri documentation for nanaimo-0.3.0
Parsing documentation for colored2-3.1.2
Installing ri documentation for colored2-3.1.2
Parsing documentation for claide-1.1.0
Installing ri documentation for claide-1.1.0
Parsing documentation for atomos-0.1.3
Installing ri documentation for atomos-0.1.3
Parsing documentation for xcodeproj-1.22.0
Installing ri documentation for xcodeproj-1.22.0
Parsing documentation for ruby-macho-2.5.1
Installing ri documentation for ruby-macho-2.5.1
Parsing documentation for nap-1.1.0
Installing ri documentation for nap-1.1.0
Parsing documentation for molinillo-0.8.0
Installing ri documentation for molinillo-0.8.0
Parsing documentation for gh_inspector-1.1.3
Installing ri documentation for gh_inspector-1.1.3
Parsing documentation for fourflusher-2.3.1
Installing ri documentation for fourflusher-2.3.1
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-try-1.2.0
Installing ri documentation for cocoapods-try-1.2.0
Parsing documentation for netrc-0.11.0
Installing ri documentation for netrc-0.11.0
Parsing documentation for cocoapods-trunk-1.6.0
Installing ri documentation for cocoapods-trunk-1.6.0
Parsing documentation for cocoapods-search-1.0.1
Installing ri documentation for cocoapods-search-1.0.1
Parsing documentation for cocoapods-plugins-1.0.0
Installing ri documentation for cocoapods-plugins-1.0.0
Parsing documentation for cocoapods-downloader-1.6.3
Installing ri documentation for cocoapods-downloader-1.6.3
Parsing documentation for cocoapods-deintegrate-1.0.5
Installing ri documentation for cocoapods-deintegrate-1.0.5
Parsing documentation for ffi-1.15.5
Installing ri documentation for ffi-1.15.5
Parsing documentation for ethon-0.16.0
Installing ri documentation for ethon-0.16.0
Parsing documentation for typhoeus-1.4.0
Installing ri documentation for typhoeus-1.4.0
Parsing documentation for public_suffix-4.0.7
Installing ri documentation for public_suffix-4.0.7
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for concurrent-ruby-1.2.2
Installing ri documentation for concurrent-ruby-1.2.2
Parsing documentation for json-2.6.3
Installing ri documentation for json-2.6.3
Parsing documentation for httpclient-2.8.3
Installing ri documentation for httpclient-2.8.3
Parsing documentation for algoliasearch-1.27.5
Installing ri documentation for algoliasearch-1.27.5
Parsing documentation for addressable-2.8.5
Installing ri documentation for addressable-2.8.5
Parsing documentation for zeitwerk-2.6.11
Installing ri documentation for zeitwerk-2.6.11
Parsing documentation for tzinfo-2.0.6
Installing ri documentation for tzinfo-2.0.6
Parsing documentation for minitest-5.19.0
Installing ri documentation for minitest-5.19.0
Parsing documentation for i18n-1.14.1
Installing ri documentation for i18n-1.14.1
Parsing documentation for activesupport-6.1.7.4
Installing ri documentation for activesupport-6.1.7.4
Parsing documentation for cocoapods-core-1.12.1
Installing ri documentation for cocoapods-core-1.12.1
Parsing documentation for cocoapods-1.12.1
Installing ri documentation for cocoapods-1.12.1
Done installing documentation for rexml, nanaimo, colored2, claide, 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, json, httpclient, algoliasearch, addressable, zeitwerk, tzinfo, minitest, i18n, activesupport, cocoapods-core, cocoapods after 47 seconds
36 gems installed

3.此步骤虽然安装成功了cocoapods,但是pod命令是不好用的,如果不信叛逆的你可以试着输入 pod --version试试,会不会出现这个,我就是这一步排雷好久啊

sh: command not found: pod

4.为了让pod听从指挥,请在终端输入以下路径配置:

PATH="`ruby -e 'puts Gem.user_dir'`/bin:$PATH"

5.然后再在终端输入:

gem install cocoapods --user-install  
截屏2023-08-08 22.01.26.png

大功已成!!!
6.可以试试输入启动"pod setup"命令,会出现绿油油的一行小字,真清爽舒适的颜色!!


截屏2023-08-08 22.03.19.png

接下来就可以想干嘛干嘛辣,管理你得第三方库辣
如果铁铁们还有遇到其他的问题留言大家一起🍑

**注意
在项目中pod install 之后 会出现以下问题

[!] CDN: trunk URL couldn‘t be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/

解决思路详参(亲测有效):在podfile文件中添加指定的spec repo源

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 211,290评论 6 491
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,107评论 2 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 156,872评论 0 347
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,415评论 1 283
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,453评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,784评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,927评论 3 406
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,691评论 0 266
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,137评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,472评论 2 326
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,622评论 1 340
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,289评论 4 329
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,887评论 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,741评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,977评论 1 265
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,316评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,490评论 2 348

推荐阅读更多精彩内容