cocoapods卸载失败

1、cocoapods安装报错

 sudo gem install cocoapods

的时候出现

While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

改为

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

即可

2、cocoapods卸载报错

 sudo gem uninstall cocoapods

的时候出现

While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

改为

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

即可

3、Mac OS 10.14 安装cocoapods报错: Failed to build gem native

如果是之前的 Mac OS 版本,网上都是通过 xcode-select --install 来解决,但是我在 Mac OS 10.14 版本下,依然存在报错。

最终找到解决方式,执行:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

然后根据提示安装即可。

4、CocoaPods could not find compatible versions for pod "xxx": In snapshot (Podfile.lock):

[!] CocoaPods could not find compatible versions for pod "MJRefresh":
  In snapshot (Podfile.lock):
    MJRefresh (= 3.1.15.3)

  In Podfile:
    MJRefresh

None of your spec sources contain a spec satisfying the dependencies: `MJRefresh, MJRefresh (= 3.1.15.3)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

解决方法:

把.xcworkspace和Podfile.lock文件删除,重新pod install一下就好了!

你可能感兴趣的:(cocoapods卸载失败)