Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pod setup cannot find cocoapods

After installing cocoapods with sudo gem install cocoapods, attempting to run "pod setup" returns this error:

Could not find 'cocoapods' (>= 0) among 22 total gem(s) (Gem::LoadError)

Output from "pod setup":

/Users/Kevin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:313:in `to_specs': Could not find 'cocoapods' (>= 0) among 22 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Kevin/.rvm/gems/ruby-1.9.3-p194:/Users/Kevin/.rvm/gems/ruby-1.9.3-p194@global', execute `gem env` for more information
    from /Users/Kevin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:322:in `to_spec'
    from /Users/Kevin/.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/Kevin/.rvm/rubies/ruby-1.9.3-p194/bin/pod:22:in `<main>'

When I check the directory listed in GEM_PATH, it includes:

...
drwxr-xr-x   5 root   staff   170B Jun 16 23:35 cocoapods-core-0.33.1/
drwxr-xr-x   5 Kevin  staff   170B Jun 16 23:41 cocoapods-downloader-0.6.1/
drwxr-xr-x  15 Kevin  staff   510B Jun 16 23:41 cocoapods-plugins-0.2.0/
drwxr-xr-x  11 Kevin  staff   374B Jun 16 23:41 cocoapods-trunk-0.1.3/
drwxr-xr-x  15 Kevin  staff   510B Jun 16 23:41 cocoapods-try-0.3.0/
...

So the files are there, though its core is root since I used sudo gem install cocoapods.

Solutions suggested on previous Stack Overflow questions that I've tried:

  1. Install cocoapods without sudo: Suggested here. However, even following these instructions I get permission denied when trying to use gem install cocoapods.

  2. Sudo pod setup: Suggested here. However, pod tells me that I can't use it in sudo.

  3. Change permissions for cocoapods files: Suggested here. I tried running the lines provided by the top answer but it says that those files do not exist.

How do I get pod setup to work?

like image 525
Kevin Avatar asked Jun 20 '14 06:06

Kevin


People also ask

How do you install pods CocoaPods?

To install the pods, do one of the following: Place the caret at the code line where you add the pod, press ⌥ ⏎ , select Install, and press ⏎ . Click Install pods in the top-left corner of the editor window. From the main menu, select Tools | CocoaPods | Install.

How do I know if CocoaPods is installed on my Mac?

To find if Cocoapods is installed or not run cmd (pod --version). if theresult is (Not Found) Pods is not installed.

Should I install CocoaPods with GEM or homebrew?

I would suggest you install CocoaPods using brew . It's a little cleaner option and you can update it easier. The cocoapods cask is for CocoaPads App and the formula is for the CLI only version.


2 Answers

Don't use sudo.

1: sudo gem uninstall cocoapods 

2: gem install cocoapods

3: pod install 
like image 52
hellion Avatar answered Oct 27 '22 14:10

hellion


I had the same issue. I solved it by

  1. Removing cocoapods
  2. Reinstalling it using rvmsudo instead of sudo
    rvmsudo gem install cocoapods

Hope it helps!

like image 31
Alfonso Murillo Bolaños Avatar answered Oct 27 '22 16:10

Alfonso Murillo Bolaños