安裝Brew
執(zhí)行以下語句,選擇一個安裝brew的源(我選的清華源)
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
安裝完成后可以繼續(xù)安裝Core、Cask等
配置后續(xù)使用brew 安裝軟件時使用的原 [圖片上傳失敗...(image-62f9b2-1727216869492)]
可以看到,速度還是挺快的
使用brew安裝cmake
brew install cmake
使用brew安裝python
brew install python
使用brew安裝ninja
brew install ninja
安裝 Apple Command Line
xcode-select --install
安裝ruby
查看系統(tǒng)自帶的ruby版本
ruby -v
[圖片上傳失敗...(image-4a7b48-1727216869492)]
安裝rvm,使用rvm管理ruby
安裝rvm命令 curl -L get.rvm.io | bash -s stable
立即更新,讓shell的當(dāng)前session生效 // zsh,新版系統(tǒng)默認(rèn)shell都是zsh source ~/.zshrc source ~/.profile
使用rvm查看可安裝的ruby有哪些
rvm list known
<pre>
js
代碼解讀
復(fù)制代碼
`# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.10]
[ruby-]2.5[.8]
[ruby-]2.6[.6]
[ruby-]2.7[.2]
[ruby-]3[.0.0]
ruby-head
for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2
JRuby
jruby-1.6[.8]
jruby-1.7[.27]
jruby-9.1[.17.0]
jruby[-9.2.14.0]
jruby-head
Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.107]
rbx-4[.20]
rbx-5[.0]
rbx-head
TruffleRuby
truffleruby[-20.3.0]
Opal
opal
Minimalistic ruby implementation - ISO 30170:2012
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1.3.0
mruby-1[.4.1]
mruby-2.0.1
mruby-2[.1.1]
mruby[-head]
Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02]
Topaz
topaz
MagLev
maglev-1.0.0
maglev-1.1[RC1]
maglev[-1.2Alpha4]
maglev-head
Mac OS X Snow Leopard Or Newer
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head
IronRuby
ironruby[-1.1.3]
ironruby-head` </pre>
修改gem源
<pre>
js
代碼解讀
復(fù)制代碼
gem source -l gem sources --remove https://rubygems.org/ gem sources --add https://gems.ruby-china.com/ </pre>
安裝最新版ruby并設(shè)置為默認(rèn)
rvm install 3.0.0
執(zhí)行過程中可能遇到以下報錯 [圖片上傳失敗...(image-7e9de8-1727216869492)]
解決辦法如下
<pre>
markdown
代碼解讀
復(fù)制代碼
`1. brew uninstall --ignore-dependencies openssl@3
rm -rf /usr/local/etc/openssl@1.1
brew reinstall openssl@1.1
rvm install 3.0.0` </pre>
設(shè)置ruby3.0.0為默認(rèn)版本。注意這并不會覆蓋系統(tǒng)中的ruby版本
rvm use 3.0.0 --default
安裝 cocoapods
sudo gem install -n /usr/local/bin cocoapods
查看pod版本
pod --version
pod 1.13 之后會遇到這個報錯 [圖片上傳失敗...(image-344c21-1727216869492)]
解決辦法
限制為 activesupport (7.0.8) 的最新版本 不要執(zhí)行這個方法 // gem 'activesupport', '~> 7.0', '<= 7.0.8'
-
sudo gem install activesupport -v 7.0.8安裝7.0.8版本 -
gem list | grep activesupport查看已安裝的ativesupport版本 -
sudo gem uninstall activesupport刪除7.0.8外的其他版本
使用pod初始化工程并更新repo spec
<pre>
ruby
代碼解讀
復(fù)制代碼
pod setup // 更新repo spec git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git ~/.cocoapods/repos/trunk </pre>
作者:HarderCoder
鏈接:https://juejin.cn/post/7288956487720681511