前几天 macOS 10.15 Catalina
推送更新之后就第一时间更新了.
但是今天发现 Cocoapods
无法使用了:
1
2
$ pod search opencv
zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory
并且
1
pod --version
也执行报错.
一开始以为是更新系统后 Cocoapods
被干掉了, 于是执行安装命令:
1
$ brew install cocoapods
大概 5 分钟后得到了如下信息:
1
2
3
4
5
6
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/pod
Target /usr/local/bin/pod
already exists. You may want to remove it:
rm '/usr/local/bin/pod'
本来是准备卸载重装的, 手一抖, 按错, 重复执行了安装命令, 得到如下信息:
1
2
3
$ brew install cocoapods
Warning: cocoapods 1.8.3 is already installed, it's just not linked
You can use `brew link cocoapods` to link this version.
按照指引执行:
1
2
3
4
5
6
7
8
9
10
11
12
$ brew link cocoapods
Linking /usr/local/Cellar/cocoapods/1.8.3...
Error: Could not symlink bin/pod
Target /usr/local/bin/pod
already exists. You may want to remove it:
rm '/usr/local/bin/pod'
To force the link and overwrite all conflicting files:
brew link --overwrite cocoapods
To list all files that would be deleted:
brew link --overwrite --dry-run cocoapods
结果依旧.
加上路径试试??
1
2
$ brew link /usr/local/bin/pod
Error: can't find gem cocoapods (>= 0.a) with executable pod
然后开始百度, 看网上其他帖子猜测应该是新版本的系统, 目录发生了变更导致的, 重装应该能解决问题.
卸载重装
卸载 Cocoapods
1
2
3
$ sudo gem uninstall cocoapods
Password:
Gem 'cocoapods' is not installed
安装 Cocoapods
1
$ sudo gem install cocoapods
然后就继续执行 卸载
和 重装
, 问题果然得到了解决.
1
2
$ pod --version
1.8.3