How do I install a cocoapod in mavericks with ruby and Command Line Tools correctly?

匿名 (未验证) 提交于 2019-12-03 08:51:18

问题:

This is my setup:

Mavericks 10.9.1 Xcode 5.0.2 which ruby returns this:

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

but dvm install ruby returns:

Already installed ruby-2.1.0. To reinstall use:      rvm reinstall ruby-2.1.0 

So doesn't this mean I have ruby 2.1.0?

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

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' 

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>' 

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

回答1:

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

  1. Uninstall Cocoapods:

    sudo gem uninstall cocoapods 
  2. Make sure you're on the latest Ruby:

    which ruby 
  3. Install cocoapods without sudo:

    gem install cocoapods -V --no-ri --no-rdoc # V: Verbose; no-ri,no-rdoc: Do not install documentation 
  4. Set up Cocoapods:

    pod setup 

Should work now.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!