Skip to content

Instantly share code, notes, and snippets.

@mbinna
Created December 4, 2012 09:43
Show Gist options
  • Save mbinna/4202236 to your computer and use it in GitHub Desktop.
Save mbinna/4202236 to your computer and use it in GitHub Desktop.
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@ngheungyu
Copy link

Cleaning the cache doesn't mean Xocde will read the new code! One extra tips is to delete the Derived Data to prevent compiler reading the old code. Hope it helps

@justinswart
Copy link

rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; pod install;

@uzuume
Copy link

uzuume commented Jul 22, 2016

Thanks!

@orenk86
Copy link

orenk86 commented Aug 28, 2016

Clean, simple, perfect. Thanks!

@andj207
Copy link

andj207 commented Nov 10, 2016

It works. Thanks.

@jeantimex
Copy link

Thanks mate, I hate caches!

@syzer
Copy link

syzer commented Aug 15, 2017

Thanks!

@cprovatas
Copy link

<3

@ashokds
Copy link

ashokds commented Sep 26, 2017

👍 Thanks!

pod cache clear --all
pod cache clear 'alamofire'
pod cache clear 'alamofire' --all // delete all installed 'alamofire' pods

@efremidze
Copy link

efremidze commented Oct 2, 2017

Use clean instead of clear.

pod cache clean --all
pod cache clean 'alamofire'
pod cache clean 'alamofire' --all

@olgusirman
Copy link

Thanks, I use it all the time!

@Urvish-modi
Copy link

Unable to understand what happens, i command pod install with repo update and this happens.
Anyone has idea ?

screen shot 2018-01-31 at 11 05 09 am

screen shot 2018-01-31 at 11 06 04 am

@RishabhTayal
Copy link

This is AWESOME! 👍

@kr-mohak
Copy link

Thanks!

@FDiskas
Copy link

FDiskas commented Oct 8, 2019

rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; pod install;

@chronikum
Copy link

thank you. Thank you so much.

@msvargas
Copy link

thanks!

@EmmanuelC19
Copy link

thanks ! works perfect !!

@erdemildiz
Copy link

erdemildiz commented Oct 16, 2020

rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData && pod deintegrate && pod install

@pro100svitlo
Copy link

THANK YOU ❤️

@thamtumeoden13
Copy link

thank you, it's save my life

@lornebb
Copy link

lornebb commented Oct 28, 2021

Still working in Oct. 2021. Thanks!

@DavidAPears
Copy link

Still working in Dec '21. Thanks

@coderjonny
Copy link

Still working in Apr 2022.. thanks!

@mikeest1972
Copy link

mikeest1972 commented Apr 8, 2022

For M1 mac pod update should change to arch -x86_64 pod update. Here is a version of script for M1 mac users link

@jamescavallo
Copy link

TY

@taosif7-dreamorbit
Copy link

Still working in Nov 2022. Thanks.

@doron2402
Copy link

Thanks!
still working Dec 2022 :)
This one worked too

 pod cache clean --all && pod deintegrate && pod install

@developmistine
Copy link

rm -rf ~/Library/Caches/CocoaPods; rm -rf Pods; rm -rf ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; pod install;

Is worked for me

@ArthurBrum
Copy link

What about the specs inside directory ~/.cocoapods/repos/* ?

I ask this because sometimes I get this warning message. Does this count as cache too??

[!] Found multiple specifications for `Analytics (3.0.1)`:
- /Users/arthurbrum/.cocoapods/repos/[company-address-for-pods]/Analytics/3.0.1/Analytics.podspec.json
- /Users/arthurbrum/.cocoapods/repos/trunk/Specs/a/7/6/Analytics/3.0.1/Analytics.podspec.json

@mwaqarshahid
Copy link

Thanks man, clearing cache worked like a charm. 😊

@aleena-adnan1
Copy link

just delete your derived data and it'll fix

@NdegwaJulius
Copy link

I faced the same problem recently but this works for me : https://stackoverflow.com/a/19131855/9322353

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment