显然在某个时候我通过
sudo gem install cocoapods
安装了cocoapods。这似乎已将 cocoapods 二进制文件放入 /usr/bin
中。似乎在某些 macOS 更新后此目录变为只读。现在,我想删除这个旧版本,但是当我尝试执行sudo gem uninstall cocoapods
时,我收到以下错误:
Fire:~ root# sudo gem uninstall cocoapods
Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5
Remove executables:
pod, sandbox-pod
in addition to the gem? [Yn]
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
如您所见,我已经通过
sudo -i
从 root 用户进行了尝试,但没有成功。我也尝试过禁用 SIP,然后以 root 身份执行它,但遗憾的是没有成功。有什么方法可以删除此文件夹或者全新安装是唯一的可能性吗?
经过多次不成功的尝试,我找不到删除已安装在
/usr/bin
中的东西的方法。我最终重新安装了 macOS 以拥有一个干净的系统,因为我有很多旧的 gem,它们可能会在某些时候干扰我的工作流程。