iosrubymacoscocoapodsosx-elcapitan

Not able to install cocoa pods on EL Capitan 10.11.1


Getting the following error:

ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://rubygems.org/latest_specs.4.8.gz)

Please help.


Solution

  • First you have to update your system (Which will install the ruby gems)

    STEPS TO INSTALL COCOAPODS

    UPDATE SYSTEM

    sudo gem update --system
    

    INSTALL COCOAPODS

    Before EL Capitan

    sudo gem install cocoapods 
    

    After EL Capitan

    sudo gem install -n /usr/local/bin cocoapods
    

    SETUP POD

    pod setup
    

    POD INIT (GO TO YOUR PROJECT DIRECTORY)

    pod init
    

    OPEN AND UPDATE POD FILE

    open -a Xcode Podfile 
    

    INSTALL THE PODs AS PER YOUR NEED

    pod install
    

    UPDATE : Cocoapods installation with Homebrew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    export PATH=/opt/homebrew/bin:$PATH
    
    brew install ruby
    
    brew install cocoapods
    
    pod --version
    
    pod install