解决macOS搭建flutter错误 CocoaPods not installed
浏览地址: https://guides.cocoapods.org/using/getting-started.html#installation
先安装gem:
brew install gem
根据提示,要安装Ruby:
brew install ruby
根据提示:
If you need to have ruby first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
For compilers to find ruby you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"
进行如下配置:
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"
此时, 就有gem这个命令了:
安装命令:
sudo gem install cocoapods
这一步安装的东西比较多, 可能等待的时间比较长:
查看安装位置:
gem which cocoapods
再配一个环境变量:
export PATH="/Users/zhangdapeng/.local/share/gem/ruby/3.3.0/bin:$PATH"
最后执行下面的命令检查:
fluttor doctor