HJH
HJH

Reputation: 11

How to setup cocoapods?

I installed cocoapods for an iOS project, but when I wrote this command pod setup --verbose nothing happened, so I tried some other code but it got worse, and now when I setup cocoapods I get this error:

/Library/Ruby/Site/2.3.0/rubygems.rb:275:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
    from /Library/Ruby/Site/2.3.0/rubygems.rb:252:in `bin_path'
    from /usr/local/bin/pod:22:in `<main>'

Upvotes: 0

Views: 1963

Answers (1)

Nicholas
Nicholas

Reputation: 755

I don't know what happened, but the usual procedure of installing Cocoapods and setting it up is as follows:

Installing Cocoapods

  1. Open Terminal
  2. Type sudo gem install cocoapods
  3. Type your password and wait for it to finish

Initializing Xcode project for Cocoapods

  1. In terminal, switch to your project's directory using the cd command
  2. Type pod init. This will add a Podfile to your project, which you can open and add the pods you want.
  3. Type pod install. This will also generate a .xcworkspace file along with your .xcodeproj file, and you should always use the former from now on.

With your situation where it seems like pod was either not installed or not installed properly, I suggest you try sudo gem uninstall cocoapods first to remove everything that might be present, then follow the steps above. Also, if that fails, please check that you have the lastest version of Ruby installed.

Upvotes: 1

Related Questions