Updating to latest version of CocoaPods?

ぐ巨炮叔叔 提交于 2019-11-29 18:45:25
user3899562

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

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

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

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

If you are using Homebrew, open terminal and type:

brew upgrade cocoapods

If that does not work, try:

brew install cocoapods

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

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

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

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.

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
Abubakar Bizimana
First check cocoapods version
like pod --version
then update like sudo gem install cocoapods --pre

after update you can also check cocoapods version.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!