一下所有命令均在终端中执行。
1.报错信息:
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
解决方案:
1、更新gem:sudo gem update —system
执行此步报错信息:
ERROR: While executing gem … (Errno::EPERM)
Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem
解决方案:
sudo gem update -n /usr/local/bin —system
2、删除gem源:gem sources —remove https://ruby.taobao.org/
3、修改gem源:gem sources -a https://gems.ruby-china.org
4、查看gem源是否是最新的:gem sources -l
5、升级cocoapods:sudo gem install -n /usr/local/bin cocoapods —pre
会出现这个报错 “ERROR: While executing gem ... (URI::InvalidURIError)
URI must be ascii only "?gems=\u{2014}pre"”
解决:使用 sudo gem install -n /usr/local/bin cocoapods 就不会有报错了。
6、查看升级后的cocoapods版本:pod —version