How to install specific pod without touching other dependencies
Asked Answered
A

9

44

I want to install specific dependency using cocoapods. if I execute pod install, other dependencies are getting updated before installing my newly added dependency. I just want to install specific pod without touching any others. And I know deleting, updating any dependency also updates others. Is there any way to solve this problem?

Actually my problem is when I myself modify some dependency (AFNetworking for example) and run pod install it reverts back to its original version. But I don't want to lose my changes.

Angst answered 21/5, 2015 at 11:22 Comment(9)
What dependency are you updating? I would make it so my project can take future pod install commands.Rubdown
pod "AFNetworking", "~> 2.2.1". In this dependency I mad changes by myself, and added another dependency to the project. When I run pod install my changes in AFNetworking are loosingAngst
@ShamsiddinSaidov, why do you want to modify a pod? It's not a good practice (exactly because of difficulties with updates). If you really need it, the better approach is to fork AFNetworking, modify your own fork, and install your fork instead of the original AFNetworking library. I saw a question about it here somewhere several days ago.Russia
Yes, you are right, but anyway If I don't want to update my existing pods what is the solution? Say my project works with the old version of the pod and it shouldn't update to the new one?Angst
@ShamsiddinSaidov, you could write the version explicitly like so: pod 'AFNetworking', '2.2.1'Russia
:) ok. I'll fork the AFNetworking. Seems it's the best solution.Angst
Hey @ShamsiddinSaidov, Did get any solution for this?Vibrissa
@Yuyutsu, I didn't do anything. But if you have this problem I think you need to follow FreeNickname's above mentioned solutions.Angst
@ShamsiddinSaidov, Yes, I did that same :)Vibrissa
L
54

To Skip running pod repo update before install.Use

pod install --no-repo-update
Louvre answered 7/10, 2015 at 15:3 Comment(1)
This still update the other pods as I was trying to skip updation of other pods that were that for xcode 8.3.3 and now after migration to xcode 9 they didn't get converted like in previous xcode versions.Particia
S
43

To install a plugin without updating existing ones-> Add that plugin in your Podfile and use:

pod install --no-repo-update

To remove/update a specific plugin use:

pod update POD_NAME

Tested!

Stambaugh answered 1/4, 2016 at 11:22 Comment(7)
Seems a little strange at first, but this works as atulkhatri mentioned when removing a single library. Remove the item from your pod file and run update podname.Highstepper
@Highstepper not working for me to remove FacebooCore library :(Adsorbate
@Niki I have same problem with 'FacebookCore'. Have you find any solution?Gonsalves
@YogendraPatel It is possible that some other third-party framework has added on older version of Facebook SDK as a dependency. Could you please check your Podfile.lock to see if that is not the case?Stambaugh
This still seems to meddle with the other Pods already installed.Tanhya
@HashimAkhtar If more than 1 pod rely on the same framework, it might be a good idea to update both of them to avoid incompatibility.Stambaugh
pod update POD_NAME which is also not working; It is updating other pods.Barnabe
E
26

1) If you want to update single pod

pod update 'yourpodname'

2) if you want to install one pod without affecting another pod

pod install --no-repo-update

3)if you want to install/update specific version of pod

pod 'Stripe', '3.0'

4) if you want to install/update latest version of pod than

pod 'KCFloatingActionButton'

Etheleneethelin answered 7/3, 2018 at 11:7 Comment(1)
pod install --no-repo-update is out dated, not working.... Is there any other solution.Barnabe
T
3

Here you can skip integration of the Pods libraries in the Xcode project(s) by using following command.

pod install --no-repo-update

Pod install

Hope this help you.

Thankless answered 21/5, 2015 at 11:50 Comment(4)
@Shamsiddin Saidov, this command only add new pod that is not integrate earlier.Thankless
It didn't help. pod install --no-repo-update also updating existing podsAngst
I have AFNetworking integrated in my project and I modified some classes in it. When I added another pod, say pod 'Facebook-iOS-SDK', '~> 4.1' and run pod install --no-integrate it reverts back my modified AFNetworking classes to it's original version. I.e. it's updating my already installed dependencies before installing Facebook-iOS-SDKAngst
--no-integrate is out of date.Civil
G
2

At the time of writing, pod install will only install pods in the PodFile that haven't already been installed. The others will not be updated. This issue appears to have been solved by the CocoaPods project.

Grimona answered 7/10, 2015 at 14:42 Comment(1)
this doesnt seem to be the case when there is a major revision update for Cocoapods itself... i.e. Version 1.0.0 was release just recently but because its a major version evidently it tries to update all pods to the latest , even when specifying otherwise int he command line - at least thats what happened in my caseSlavism
A
0

Do not get confused just open up the existing file and added the numbers of pod file below the existing pods.

Further, go to terminal and open up your project and run command:

$ pod install

(This command will only add on the new pod without disturbing your existing pods)

Applied answered 26/10, 2017 at 14:1 Comment(0)
B
0
pod repo update && pod update 'YOURPOD'
Blackshear answered 9/11, 2017 at 15:45 Comment(0)
D
-1

If you have your first "Podfile.lock" in your project folder, you just have to use

pod install

Your "Podfile.lock" has registered the version of your old pod so you don't need to do something else

Dhow answered 1/7, 2017 at 1:25 Comment(1)
That's not what the OP had asked. The question is how to install only a newly added POD in the podfile instead of updating ALL the pods from repo which pod install does.Ganof
Y
-2

Here is another way of doing it. If you want to install newly added pod and don't want to update other dependancies you need to remove "~>" from all your pods you don't want to update. For example in case of AFNetworking

pod 'AFNetworking', '2.2.1'   instead of pod 'AFNetworking',~> '2.2.1' 
Ye answered 28/10, 2016 at 6:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.