1.先找下本地的ruby文件目录,我这里本地是/Users/mac/.gem/ruby/2.6.0/bin
1.png
2.添加路径到对应bash_profile位置
命令行操作
vi $HOME/.bash_profile
输入i进入编辑模式,添加一行内容到文件中,注意这里替换成自己在第一步中的路径
export PATH="/Users/mac/.gem/ruby/2.6.0/bin:$PATH"
键Esc,输入:wq
命令行再输入
source ~/.bash_profile
3.执行完了上面步骤以后,在xcode项目中执行pod install时候报错
Traceback (most recent call last):
2: from /usr/local/bin/pod:23:in `<main>'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
这里的解决步骤如下:
sudo gem update --system
接下来是
gem install cocoapods
解决步骤参看
网友评论