昨晚回家之后开始升级系统到10.11,下载了一整个晚上之后终于在早上下载完毕,早上带到公司,想查一个第三方库的时候却遇到了问题:

guoyufudeMacBook-Pro:~ GuoYufu$ pod search VKVideoPlayer
-bash: pod: command not found

接着尝试:

guoyufudeMacBook-Pro:~ GuoYufu$ gem sources -l
*** CURRENT SOURCES *** http://ruby.taobao.org/

这里没错。

guoyufudeMacBook-Pro:~ GuoYufu$ pod help
-bash: /usr/local/bin/pod: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory

然后基本确定是系统升级之后导致CocoaPods不能正常使用。继续查找解决方案:

1.首先考虑重新安装CocoaPods:

guoyufudeMacBook-Pro:~ GuoYufu$ sudo gem install cocoapods
Password:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod

失败。

2.继续根据报错信息查找解决方法,运行查到的:

sudo gem install -n /usr/local/bin cocoapods

提示:

Successfully installed cocoapods-0.38.2
Parsing documentation for cocoapods-0.38.2
1 gem installed

莫非成功了?

尝试:

pod search VKVideoPlayer

可以正常执行。

尝试更新一下CocoaPods的版本:

guoyufudeMacBook-Pro:~ GuoYufu$ sudo gem install cocoapods
Password:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod

还是报错。

3.索性按照最初安装的步骤全部来一遍:

安装Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装Ruby后重新安装CocoaPods

brew install ruby
sudo gem install cocoapods

终于不再报错了。

05-01 03:17