Cocoapods安装时遇到的坑!

可能是之前安装了,然后升级系统之后,现在需要用到,发现死活运行不起来。

1、之前运行pod setup,还会提示 /usr/local/bin 这个文件夹只可读,无法操作,我们只需要更改下他的读写权限即可

sudo chmod go-w /usr/local/bin


2、

$ pod setup

Setting up CocoaPods master repo

fatal: Not a git repository (or any of the parent directories): .git

[!] The `master` repo is not a git repo.


这是说明没有找到.git目录,只需要使用git创建一个目录即可:

git init


3、

$ pod setup

Setting up CocoaPods master repo

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git <command> [<revision>...] -- [<file>...]'

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git <command> [<revision>...] -- [<file>...]'

  $ /usr/local/bin/git -C /Users/guojicheng/.cocoapods/repos/master fetch origin

  --progress

  fatal: 'origin' does not appear to be a git repository

  fatal: Could not read from remote repository.

  

  Please make sure you have the correct access rights

  and the repository exists.

[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`


安装后,还是有问题,说不能设置环境,之后按照这提示运行了pod repo update --verbose 但是依然不行。之后试了下加sudo

sudo pod setup

Password:

/usr/local/lib/ruby/gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:439:in `help!':[!] You cannot run CocoaPods as root. (CLAide::Help)

这里看到关键问题了,You cannot run CocoaPods as root 这就好办了。

只要先删除之前的目录:

sudo rm -fr ~/.cocoapods/repos/master

这个时间可能有点长,因为里面有好几百兆的文件呢,等他删除完毕在运行

pod setup

之后就是下载最新的东西了,输出如下:

$ pod setup

Setting up CocoaPods master repo

  $ /usr/local/bin/git clone https://github.com/CocoaPods/Specs.git master

  --progress

  Cloning into 'master'...

  remote: Counting objects: 1631882, done.       

  remote: Compressing objects: 100% (334/334), done.       

  remote: Total 1631882 (delta 140), reused 35 (delta 35), pack-reused 1631505       

  Receiving objects: 100% (1631882/1631882), 435.48 MiB | 1.47 MiB/s, done.

  Resolving deltas: 100% (869406/869406), done.

  Checking connectivity... done.

  Checking out files: 100% (191990/191990), done.


CocoaPods 1.4.0.beta.2 is available.

To update use: `sudo gem install cocoapods --pre`

[!] This is a test version we'd love you to try.


For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.4.0.beta.2


Setup completed


这里会很慢,因为要下载很多东西,差不多有900多兆吧,慢慢等吧~




  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

苏小败在路上

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值