如何使用ruby和命令行工具在特立独行者中正确安装cocoapod? [英] How do I install a cocoapod in mavericks with ruby and Command Line Tools correctly?

查看:129
本文介绍了如何使用ruby和命令行工具在特立独行者中正确安装cocoapod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的设置:

小牛10.9.1
Xcode 5.0.2
,其中ruby返回:

Mavericks 10.9.1 Xcode 5.0.2 which ruby returns this:

/Users/quique123/.rvm/rubies/ruby-1.9.3-p194/bin/ruby

但是dvm安装ruby返回:

but dvm install ruby returns:

Already installed ruby-2.1.0.
To reinstall use:

    rvm reinstall ruby-2.1.0

所以这不是说我有ruby 2.1.0吗?

So doesn't this mean I have ruby 2.1.0?

宝石清单说我已经安装了可可豆荚和可可粉。 cocoapods-core 0.29.0和其他一些宝石。

gems list says I have installed cocoa pods & cocoapods-core 0.29.0 and some other gems.

在sudo gem安装可可豆荚之后,我得到了一堆抓取和更改日志,并成功安装了可可豆荚0.29.0。然后,它解析并安装文档,当我运行pod setup时,我得到了:

After sudo gem install cocoa pods I get the bunch of fetches and change log and Successfully Installed cocoa pods 0.29.0. It then parses and installs documentation and when I run pod setup I got:

Setting up CocoaPods master repo
Setup completed (read-only access)

所以我从教程中创建了一个文件:

So I created a file from a tutorial:

platform :iOS, '7.0'
pod 'Mantle'
pod 'TSMessages'
pod 'ReactiveCocoa'

但是当我运行pod install时,我得到:

but when I run pod install I get:

/Users/myusername/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs': Could not find 'cocoa pods' (>= 0) among 37 total gem(s) (Gem::LoadError)
    from /Users/quique123/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:309:in `to_spec'
    from /Users/quique123/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:53:in `gem'
    from /Users/quique123/.rvm/rubies/ruby-1.9.3-p194/bin/pod:22:in `<main>'

我如何正确安装Pod,为什么会收到ruby 1.9.3的消息?

How do I get the pod to install correctly and why am i getting messages of ruby 1.9.3?

推荐答案

如果您安装了rvm,请不要使用 sudo gem install cocoapods 。它会产生问题。请按照以下步骤来修复cocoapods的安装:

If you have rvm installed do not use sudo gem install cocoapods. It creates problems. Follow these steps to fix your cocoapods installation:


  1. 卸载Cocoapods:

  1. Uninstall Cocoapods:

sudo gem uninstall cocoapods


  • 请确保您在最新的Ruby上:

  • Make sure you're on the latest Ruby:

    which ruby
    


  • 安装 cocoapods 而没有 sudo

    gem install cocoapods -V --no-ri --no-rdoc
    # V: Verbose; no-ri,no-rdoc: Do not install documentation
    


  • 设置Cocoapods:

  • Set up Cocoapods:

    pod setup
    


  • 现在应该工作。

    这篇关于如何使用ruby和命令行工具在特立独行者中正确安装cocoapod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆