报错这个
pod --version
/opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems.rb:269:in 'Gem.find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
from /opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems.rb:288:in 'Gem.activate_bin_path'
from /usr/local/bin/pod:25:in '<main>'pod --version
/opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems.rb:269:in 'Gem.find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
from /opt/homebrew/Cellar/ruby/3.4.3/lib/ruby/3.4.0/rubygems.rb:288:in 'Gem.activate_bin_path'
from /usr/local/bin/pod:25:in '<main>'
✅ 修复步骤如下:
输入命令
① 查看当前的 pod 链接情况
which -a pod
/usr/local/bin/pod # ❌ 旧的(gem)
/opt/homebrew/bin/pod # ✅ 正确的(brew)
② 删除旧的 pod 链接
sudo rm /usr/local/bin/pod
③ 再次检查 pod --version
pod --version
就会版本输出号了
如果你要彻底确保环境没冲突,也可以执行这个:
hash -r # 清理 shell 缓存