在Mac上安裝CocoaPods需要使用Ruby,請(qǐng)按照以下步驟操作:
- 安裝rvm,這是 Ruby Version Manager 的縮寫,它是一個(gè)命令行工具,用于安裝不同版本的 Ruby。打開終端并輸入以下命令:$ curl -L https://get.rvm.io | bash -s stable
jishaofngdeiMac:~ dongda$ curl -L https://get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 194 100 194 0 0 126 0 0:00:01 0:00:01 --:--:-- 126
100 24532 100 24532 0 0 6681 0 0:00:03 0:00:03 --:--:-- 19736
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
curl: (92) HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
Could not download 'https://github.com/rvm/rvm/archive/1.29.12.tar.gz'.
curl returned status '92'.
Downloading https://bitbucket.org/mpapis/rvm/get/1.29.12.tar.gz
Downloading https://bitbucket.org/mpapis/rvm/downloads/1.29.12.tar.gz.asc
Found PGP signature at: 'https://bitbucket.org/mpapis/rvm/downloads/1.29.12.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Installing RVM to /Users/dongda/.rvm/
Adding rvm PATH line to /Users/dongda/.profile /Users/dongda/.mkshrc /Users/dongda/.bashrc /Users/dongda/.zshrc.
Adding rvm loading line to /Users/dongda/.profile /Users/dongda/.bash_profile /Users/dongda/.zlogin.
Installation of RVM in /Users/dongda/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/dongda/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Thanks for installing RVM ??
Please consider donating to our open collective to help us maintain RVM.
?? Donate: https://opencollective.com/rvm/donate
如果有網(wǎng)絡(luò)問題的話,你可以使用下如下命令:
curl --proxy http://127.0.0.1:19180 -L https://get.rvm.io | bash -s stable
- 執(zhí)行source命令,讓rvm生效
source /Users/dongda/.rvm/scripts/rvm
- 安裝home-brew,這個(gè)非常簡(jiǎn)單,參考:https://brew.sh/index_zh-cn,實(shí)際就一行命令:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
在這個(gè)過程中可能會(huì)遇到下面這個(gè)問題:
error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly before end of the underlying stream
error: 7532 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
解決方法:https://blog.csdn.net/qcx321/article/details/126013303
但是,之后還有問題,最后改用鏡像地址:
/bin/bash -c "$(curl -fsSL https://raw.staticdn.net/Homebrew/install/HEAD/install.sh)"
安裝成功之后提示如下:文章來源:http://www.zghlxwxcb.cn/news/detail-506319.html
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/dongda/.bash_profile
eval "$(/usr/local/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
- 最后再執(zhí)行安裝cocoapods
sudo gem install cocoapods
安裝前需要確保下ruby是最新版本:文章來源地址http://www.zghlxwxcb.cn/news/detail-506319.html
192:~ dongda$ ruby --version
ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin21]
# 安裝最新ruby版本
192:~ dongda$ rvm install ruby --latest
到了這里,關(guān)于最新Mac上如何安裝pod的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!