The Background
I am somewhat new to Unix coming from a .NET environment but I know enough now to get me in trouble.
I got an existing code I am working with that uses Cocoapods so I tried to install Cocoapods.
Initially when I installed it it failed saying it requires a newer version of Ruby. To install Ruby I used an installer called rvm. With some effort I got RVM installed and got Ruby Version 2.1.0.
When I go to directory where the app is and i type pod install
it responds with pod: command not found
. The assumption is that there must be something wrong with the install of cocoa pods. If I try any command to install or uninstall Cocoapods
gem install cocoapods or gem uninstall cocoa pods
it returns the same response which is:
/Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:59:in `gem': uninitialized constant Gem::LOADED_SPECS_MUTEX (NameError)
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:46:in `require'
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems.rb:601:in `load_yaml'
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:328:in `load_file'
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/config_file.rb:197:in `initialize'
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:74:in `new'
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/gem_runner.rb:39:in `run'
from /Users/aliabidhusain/.rvm/rubies/ruby-2.1.2/bin/gem:21:in `<main>'
I am thinking that perhaps the failed attempts to install cocoa pods may have either corrupted something, put something in the wrong place. I want to completely uninstall cocoapods and reinstall it but install and uninstall are not doing anything.
UPDATE: Using gem list --local | grep cocoa pods
just to see what version of CocoaPods I have installed gives me the same exact output.
The Question:
Does anyone know a way to either fix this issue or completely rip and rebuild CocoaPods?
I was brilliantly assisted with help from @Pedros (the currently accepted answer) but because there were so many comments back and forth I decided to clean up the answer that worked for me. I will keep his as the accepted answer since he really helped me tremendously on this one. If this is helpful to you and you choose to up vote, please also up vote the accepted answer since this is derived almost completely from his answer.
Here is what I found out : In my case it was that RVM was not installed correctly so RubyGems wasn't installed correctly. That in turn made CocoaPods not install correctly.
To completely uninstall and remove RVM: try sudo rvm implode
or you can do sudo rm -rf ~/.rvm
I did some checks to see if I had the correct versions. I will post what they should be right now but this can be different as versions keep getting updated.
ruby --version
should be 2.1.2
which ruby
should be the RVM ruby. (To see if there is no conflict with OSX`s ruby)
gem --version
should be 2.2.2
Reinstall RVM by doing this: \curl -sSL https://get.rvm.io | bash -s stable --ruby
Reinstall CocoaPods like this: gem install cocoapods
I hope this saves someone some development hours and hair loss :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With