CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
CocoaPods is built with Ruby and is installable with the default Ruby available on OS X. We recommend you use the default ruby.
Update your system
Update your system by following command in terminal.
1 |
$ sudo gem update --system |
Above command will install/update rubygems.
Install CocoaPods
Install CocoaPods in your system by following command in terminal.
1 |
$ sudo gem install cocoapods |
If you are getting errors above command then use following command.
1 |
$ sudo gem install -n /usr/local/bin cocoapods |
Check CocoaPods Version
1 |
$ pod --version |
Update CocoaPods Repository
We have to update CocoaPods repository with latest pod updates by developers. Use following command to update CocoaPods repository:
1 |
$ pod repo update |
It will take some time to update all sub repositories.
Update pod for your project
If you directly apply the command pod install then some time new pods will not be updated in your project. For that you have to remove that specific pod information from the pod file and you have to apply pod install command. It will remove pod from the project. After that again you have to add the pod information in the pod file. Again you have to apply pod install command to install new version of pod.
Follow the next steps:
1. Remove SomePod
from the Podfile
2. Run pod install
pods will now remove SomePod
from our project and from the Podfile.lock
file.
3. Put back SomePod
into the Podfile
4. Run pod install
again
This time the latest version of our pod will be installed and saved in the Podfile.lock
.
You can update single pod file as follows:
1 |
$ pod update 'POD_NAME' |
Remove all CocoaPods from a project
Install CocoaPods deintegrate and clean commands from terminal.
1 |
$ sudo gem install cocoapods-deintegrate cocoapods-clean |
Now you have to apply both command to remove all CocoaPods from your project:
1 2 |
$ pod deintegrate $ pod clean |
Happy Coding ?