CocoaPods how to install only one new library

IosXcodeCocoapods

Ios Problem Overview


I have a list of libraries in my Pod file. I decide to add new one to Pod file. But I want to keep all my previous libraies without updates and just install (add) this one library

pod 'JSAnimatedImagesView', '~> 1.0.0'

so pod update and pod install update all libraries to newer versions, but I don't want to update them just install pod 'JSAnimatedImagesView', '~> 1.0.0'

Ios Solutions


Solution 1 - Ios

pod install --no-repo-update

This installs new items without updating existing repos (versioned or not).

It's also just quicker if you have a lot of repos and want a fast install of a new item.

Solution 2 - Ios

(As of March 15, 2019)

To install 1 new pod: add the 1 desired new pod into your Podfile. Then run:

pod install --no-repo-update

It will not update any other pods when running this.

Solution 3 - Ios

If you don't want to update the specific libraries you should lock them at the versions you want to keep

pod 'AFNetworking', '1.2.0'
pod 'JSAnimatedImagesView', '~> 1.0.0'

Would keep AFNetworking on V1.2.0 but get the latest JSAnimatedImagesView

This makes the podfile transferrable to other locations (and developers) and saves you from forgetting to revert your podfile until you intend to update pods

Solution 4 - Ios

You can try to use update command https://guides.cocoapods.org/terminal/commands.html#pod_update

pod update [POD_NAMES ...]

Updates the Pods identified by the specified POD_NAMES. If no POD_NAMES are specified it updates all the Pods ignoring the contents of the Podfile.lock.

Solution 5 - Ios

When starting out with a project it is likely that you will want to use the latest version of a Pod. If this is the case, simply omit the version requirements.

pod 'SSZipArchive'

Later on in the project you may want to freeze to a specific version of a Pod, in which case you can specify that version number.

pod 'Objection', '0.9'

More info http://guides.cocoapods.org/syntax/podfile.html#pod

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMatrosov OleksandrView Question on Stackoverflow
Solution 1 - IosMiroView Answer on Stackoverflow
Solution 2 - IosBennyTheNerdView Answer on Stackoverflow
Solution 3 - IosdavbrynView Answer on Stackoverflow
Solution 4 - IosAlenaView Answer on Stackoverflow
Solution 5 - IosnspavloView Answer on Stackoverflow