mac os sierra pod install command failure - cocoapods

After moving to Mac OS Sierra, I'm facing problem to install cocoapods.
Every time I run sudo gem install cocoapods --pre every thing installed well, but while trying to install a pod, the terminal stack on Setting up CocoaPods master repo. Already updated the system with sudo gem update --system and still got the same issue, searched online to found old answers to use pod install --verbose Ss. I found in THIS answer fail again tells to install it manually.
NOTE: I have the latest version of 'Command Line Tools'. Any suggestion or how to install master repo manually?
Even when empty pod (i.e. without any pod name in it) is installed it gives
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'cocoapods' (>= 0) among 66 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/my_name/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:324:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/local/bin/pod:22:in `'

Follow the instruction given below. It may help you.
check pod version using command given below
pod --version
if there is any version installed remove it by using the command
sudo gem uninstall cocoapods
restart your mac and reinstall again using the command
sudo gem install -n /usr/local/bin cocoapods

it will be security problem with mac os Sierra, i will try it and it will work for me . u can try it.
unable to load gem cocoa pods while creating repo

Related

can't find gem cocoapods (>= 0.a) with executable pod (react-native pod install)

I just start a react-native project. However, this question had me for a day.
I tried all possible way to solve it. For example,
sudo gem uninstall cocoapods
rvm uninstall
brew install cocoapods
However, there is no luck for me.
I would like to point out that I can pod --version under other path but issue occur when I try to pod under my project path. I also tried to set rvm default version to 2.7.5 but issue still happen.
Also, I am not using Apple M1
Traceback (most recent call last):
4: from /Users/nicholas/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `<main>'
3: from /Users/nicholas/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval'
2: from /Users/nicholas/.rvm/gems/ruby-2.7.5/bin/pod:23:in `<main>'
1: from /Users/nicholas/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:296:in `activate_bin_path'
/Users/nicholas/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
Try running bundle install in the root of your project. Then either go to ios and run pod install or use npx pod-install from the project root.
This issue is due to the difference in your default ruby version and ruby version specified in Gemfile . To install multiple ruby version you have to install rvm on your system and then install multiple rub versions. after install the ruby version specified in you gem file. you have to run the bundle install command . link
bundle install is a command we use to install the dependencies specified in your Gemfile.
Gemfile
Simply put, Gemfile is a format for describing gem dependencies for Ruby programs. Or you can say it contains the gems you need in this project.
After this you can install run npx pod-install or cd ios and pod install
Bundle install prior to pod install works.
To answer Bundle Install, what happens is, when generating react native project the configuration is set to default mac gem version. If you have updated gem version on your mac the project configuration could not pick the correct gem version. thats why it throws the can't find gem cocoapods.
by doing Bundle install, It will update the project config according to the mac gem version.
Remove cocoapods:
sudo gem uninstall cocoapods
Then instal again:
sudo gem install -n /usr/local/bin cocoapods

Determining how cocoapods was installed

Background
A few years ago I installed cocoapods for a project I was working on. Since then I have not used it and now I need to update it to get Flutter working.
System
OS MacOS Mojave
Version 10.14.3
Question
I do not want to end up installing 2 different versions of cocoapods and cause myself a bunch of problems. I am trying to determine how I originally installed cocoapods so I can update it.
How can I determine how cocoapods was originally installed?
What I Tried
I can see cocoapods is installed because when I run,
pod --version the output is
1.3.1
When I run which cocoapods I get
cocoapods not found
When I run which pod I get
/usr/local/bin/pod
I checked that file and it is a cocoapods file installed by a ruby gem. This is what I see when I look at the file,
!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
#
This file was generated by RubyGems.
#
The application 'cocoapods' is installed as part of a gem, and
this file is here to facilitate running it.
At this point I try and update it,
gem update cocoapods
I get,
Updating installed gems Nothing to update
When I run gem list I get a list of installed gems but pods nor cocoapods is in the list.
I also checked brew list and do not see it installed in there either. I can see evidence that it was installed as a gem but I do not understand why gem update cocoapods finds nothing to update.
Update
I broke down and went ahead and tried to install cocoapods as a gem since I already had the gem file in place.
gem install cocoapods
When I run gem list it shows that cocoapods was installed as version 1.6.1 as there are a bunch of new cocoapods files in my gem list.
When I run pod --version it still says 1.3.1.
I removed the pod file from /usr/local/bin and then ran pod --version again. At this point I get a command not found error.
After adding it back I can see the same output of the old version exists again. 1.3.1.
I tried removing the old pod file from /usr/local/bin and then gem install cocoapods. After doing so the pod command will not work but I can see that cocoapods is installed as a gem on my system.
Evidently there is a problem installing cocoapods on some newer MacOS systems due to the all of the permissions changes rolled out from Apple.
I saw a suggestion to install cocoapods on El Captain like this,
sudo gem install -n /usr/local/bin cocoapods
Which would explain why I have a rogue pod file inside of that directory.
Solution
I deleted the pod file out of my /usr/local/bin folder.
I installed cocoapods again using => sudo gem install -n /usr/local/bin cocoapods
Now when I run pod --version I get 1.6.1.

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

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?
If you have rvm installed do not use sudo gem install cocoapods. It creates problems. Follow these steps to fix your cocoapods installation:
Uninstall Cocoapods:
sudo gem uninstall cocoapods
Make sure you're on the latest Ruby:
which ruby
Install cocoapods without sudo:
gem install cocoapods -V --no-ri --no-rdoc
# V: Verbose; no-ri,no-rdoc: Do not install documentation
Set up Cocoapods:
pod setup
Should work now.

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

After installing cocoapods with sudo gem install cocoapods, attempting to run pod setup returns this error:
Could not find 'cocoapods' (>= 0) among 64 total gem(s) (Gem::LoadError)
Output from sudo gem install cocoapods:
CHANGELOG:
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0)
• [CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.28.0...0.29.0)
• [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader/compare/0.2.0...0.3.0)
[ bug/enhancement notes removed for brevity]
Successfully installed cocoapods-0.29.0
Parsing documentation for cocoapods-0.29.0
1 gem installed
When I list the gems installed, I do not see cocoapods listed among my Local Gems but I do see 'pod' listed in /usr/local/Cellar/ruby/2.0.0-p0/bin.
System Configuration:
Mac OS 10.9 (upgraded from 10.8)
Xcode: 5.0.2 (upgrade from 4.x)
Ruby path: /usr/local/Cellar/ruby/2.0.0-p0
How can I get cocopods to work for me?
Uninstalling and reinstalling CocoaPods from the Terminal fixed the issue for me (see the CocoaPods documentation for more information):
gem uninstall cocoapods
gem install cocoapods
For me it was
sudo gem install cocoapods
Try:
sudo pod setup
Since you installed cocoapods as supervisor (sudo), there are files that supervisor can see that you can not.
This also means that after you add a pod to a podFile, you'll also need to run
sudo pod install
instead of
pod install
It ultimately might be better to undo the sudo install of cocoa pods and use RVM.
With RVM you can have different versions of gem sets (including different versions of cocoapods, if required). By going this route, you can then bypass having to run pod commands as sudo.
Simple do this thing write below thing in terminal..
sudo gem install -n /usr/local/bin cocoapods
you do not need to install cocapods using sudo
try:
gem install cocoapods
then:
pod
to check if it runs fine

unable to load gem cocoa pods while creating repo

rubygems/dependency.rb:296:in `to_specs': Could not find 'cocoapods' (>= 0) among 35 total gem(s) (Gem::LoadError)
from /Users/divyam.shukla/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /Users/user/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/user/.rvm/gems/ruby-2.0.0-p247/bin/pod:22:in `<main>'
I am getting this error.
Hey I had the same problem that you have, I solve it following the next steps:
(I strongly recommend to use rvm to manage ruby versions)
Remove cocoapods using gem uninstall cocoapods
Install rvm, to do this I followed this steps
https://rvm.io/rvm/install
After that reinstall cocoapods using gem install cocoapods
run pod setup
And after that everything works like a charm!.
You could notice that I didn't use sudo.
Hope it could helps you.
EDIT: If you have a slow internet connection it could take several minutes, to check the progress or steps use pod setup --verbose
I just ran this without doing any changes using rvm.
I do have rvm version: rvm 1.25.30 (stable).
Step 1: sudo gem uninstall cocoapods
Step 2: gem install cocoapods
Step 3: pod setup
Make sure not to install with sudo.
do this :
sudo gem install -n /usr/local/bin cocoapods

Resources