ios - Updating to latest version of CocoaPods?


Translate

I'm having some issues installing Alamofire 4.0 into my project.

I've got the latest version of Xcode, running Swift 3, and when I try to install alamofire I'm getting like 800 compiler errors.

Apparently

CocoaPods 1.1.0+ is required to build Alamofire 4.0.0+

I looked at the version of CocoaPods I have in terminal and it says I'm at 1.0.1.

Running an update didn't work I guess because CocoaPods 1.1 is in beta.

So I'm not exactly sure how to update it up to where I'm good to go. Unless being out of date doesn't force like 800 compiler errors? Does that sound like some other issue?



All Answers
  • Translate

    Execute the following on your terminal to get the latest stable version:

    sudo gem install cocoapods
    

    Add --pre to get the latest pre release:

    sudo gem install cocoapods --pre
    

  • Translate

    Open the Terminal -> copy below command

    sudo gem install cocoapods
    

    It will install the latest stable version of cocoapods.

    after that, you need to update pod using below command

    pod setup
    

    You can check pod version using below command

    pod --version
    

  • Translate

    If you got System Integrity Protection enabled or any other permission write error, which is enabled by default since macOS Sierra release, you should update CocoaPods, running this line in terminal:

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

    After installing, check your pod version:

    pod --version
    

    You will get rid of this error:

    ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory
    

    And it will install latest CocoaPods:

    Successfully installed cocoapods-x.x.x
    Parsing documentation for cocoapods-x.x.x
    Installing ri documentation for cocoapods-x.x.x
    Done installing documentation for cocoapods after 4 seconds
    1 gem installed
    

  • Translate

    For those with a sudo-less CocoaPods installation (i.e., you do not want to grant RubyGems admin privileges), you don't need the sudo command to update your CocoaPods installation:

    gem install cocoapods
    

    You can find out where the CocoaPods gem is installed with:

    gem which cocoapods
    

    If this is within your home directory, you should definitely run gem install cocoapods without using sudo.

    Finally, to check which CocoaPods you are currently running type:

    pod --version
    

  • Translate

    If you are using Homebrew, open terminal and type:

    brew upgrade cocoapods
    

    If that does not work, try:

    brew install cocoapods
    

  • Translate

    Below are steps to update cocoapods :

    1. Open terminal (Shortcut : Press cmd + space tab to open Spotlight then text in terminal)
    2. Use command sudo gem install cocoapods. This will ask for system password due to security concern thereafter it installs gems

    Screenshot 1

    1. Now, set up pod using pod setup command. This will setup cocoapods master repo.

    Screenshot 2

    1. You can check the version of cocoapods using pod --version command.

    Screenshot 3


  • Translate

    I tried updating and didn't work. Finally , I had to completely remove (manually )cocoapods, cocoapods-core , cocoapods-try.. any other package use by cocoa pods. Use this terminal command to list all the packages : gem list --local | grep cocoa pods

    After that , I also delete ./cocoapods folder from user root folder.


  • Translate

    You can solve this problem by simply Commands:

    First:

    sudo gem install cocoapods
    

    Desp: type user mac password now your cocoapods will be replace with a stable version.

    if you have cloned the repo the type this command:

    pod repo update
    

    close your xcode and run this command

    Pod install
    

  • Translate

    This is a really quick & detailed solution

    Open the Terminal and execute the following to get the latest stable version:

    sudo gem install cocoapods
    

    Add --pre to get the latest pre release:

    sudo gem install cocoapods --pre
    

    Incase any error occured

    Try uninstall and install again:

    sudo gem uninstall cocoapods
    sudo gem install cocoapods
    

    Run after updating CocoaPods

    sudo gem clean cocoapods
    

    After updating CocoaPods, also need to update Podfile.lock file in your project.

    Go to your project directory

    pod install
    

  • Translate
    First check cocoapods version
    like pod --version
    then update like sudo gem install cocoapods --pre
    
    after update you can also check cocoapods version.
    

    enter image description here


  • Translate

    I change the line "pod 'Alamofire', '~> 4.0'" to "pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire', :commit => '3cc5b4e'" after that in terminal: "pod install --repo-update" and it works.