前序安装步骤参考这个文章即可,简单明了。 # CocoaPods安装方法-2023.09.15
我讲几个我安装过程中遇到的问题:
不管报什么错误,先去严格检查这三个东西安装好没有!!!
不管报什么错误,先去严格检查这三个东西安装好没有!!!
不管报什么错误,先去严格检查这三个东西安装好没有!!!
rust
1、Xcode
2、Command Line Tools for Xcode
3、Homebrew
可能的报错情况:
1、执行➜ rvm install ruby-3.2.2
报错了。。。
a.首先确保homebrew update
和 homebrew doctor
都成功了,执行提示这个了Your system is ready to brew.
,没有就在回去安装.
另外最新homebrew
安装完了还要执行两个命令:
bash
echo "eval $(/opt/homebrew/bin/brew shellenv)" >> ~/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
b.去xcode -> setting-> locations
检查看Command Line Tools
有没有安装,路径对不对!!
前面都没问题了,如果还报错误,可能的错误信息如下。
报错类似如下:Error running '__rvm_make -j8'
或者openssl 错误
ruby-3.2.2
Searching for binary rubies, this might take some time.
DNo binary rubies available for: osx/14.0/arm64/ruby-3.2.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/eddie/.rvm/rubies/ruby-3.2.2, this may take a while depending on your cpu(s)...
ruby-3.2.2 - #downloading ruby-3.2.2, this may take a while depending on your connection...
ruby-3.2.2 - #extracting ruby-3.2.2 to /Users/eddie/.rvm/src/ruby-3.2.2 - please wait
ruby-3.2.2 - #configuring - please wait
ruby-3.2.2 - #post-configuration - please wait
ruby-3.2.2 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/eddie/.rvm/log/1696846129_ruby-3.2.2/make.log
There has been an error while running make. Halting the installation.
执行以下命令修复:
css
rvm reinstall 3.2.2 --with-openssl-dir=$(brew --prefix openssl) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml) --disable-dtrace --disable-docs
2、都安装成功后,执行pod 命令时报错类似:
javascript
undefined method `deprecator' for ActiveSupport:Module ( **NoMethodError** )
/Users/eddie/.rvm/rubies/ruby-3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in
<class:Array>': **undefined method
deprecator' for ActiveSupport:Module (** NoMethodError )
deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator ^^^^^^^^^^^
Did you mean? deprecate_constant
解决方法:
我这里使用的是1.13.0 pod版本!!!
先执行命令:
sudo gem uninstall activesupport
提示:
csharp
You have requested to uninstall the gem:
activesupport-7.1.0
cocoapods-core-1.13.0 depends on activesupport (>= 5.0, < 8)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN] y
Successfully uninstalled activesupport-7.1.0
然后再执行这个命令:
sudo gem install activesupport -v 7.0.8
提示:
Fetching
Successfully installed activesupport-7.0.8
Parsing documentation for activesupport-7.0.8
Installing ri documentation for activesupport-7.0.8
Done installing documentation for activesupport after 0 seconds
1 gem installed
在试试pod 命令应该就可以了。。。