使用cocoapods更新第三方库时出现错误(/usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory)意思就是Ruby的版本与当前系统不适配,最近确实升级了系统到 macOS Catalina 10.15.3
解决方案:
终端更新brew、ruby和cocoapods
1.更新brew
$ brew update
2.更新完brew,更新ruby
$ brew install ruby
3.最后开始更新cocoapods
$ sudo gem install -n /usr/local/bin cocoapods
但是在第二步的时候报错:
Error: The following directories are not writable by your user:
/usr/local/share/man/man3
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/share/man/man3
大概的意思就是文件权限的问题,如下图:
解决方法:
按顺序终端执行
sudo chown -R whoami
:admin /usr/local/bin
sudo chown -R whoami
:admin /usr/local/share
完成后就可以继续执行上面的步骤进行更新cocoapods,更新完成后使用cocoapods丝滑般的顺畅。