Cocoapod is a package dependency manager for Objective-C and Swift projects with XCode. In a expo bare development environment you may need to re-install Cocoapods or in short Pods occasionally.
In this tutorial I will show you the proper way to re-install pods in a bare react native project setup. For example you may need to remove all pods and its cache to debug some errors or warnings due to changes in system.
Before re-installing you must delete cache from wherever ios concerns; Here’s the process I do to clear its cache:
- Delete npm cache:npm cache clean --forcenpm cache clean --force
npm cache clean --force
- Delete All ios temp files:cd ios && rm -rf Pods/ Podfile.lock {yourProject}.xcworkspacecd ios && rm -rf Pods/ Podfile.lock {yourProject}.xcworkspace
cd ios && rm -rf Pods/ Podfile.lock {yourProject}.xcworkspace
- Clear Cocoapods Cache:rm -r ~/Library/Caches/CocoaPodsrm -r ~/Library/Caches/CocoaPods
rm -r ~/Library/Caches/CocoaPods
- Now install pods via npx:cd .. && npx pod-installcd .. && npx pod-install
cd .. && npx pod-install
- You can also install from ios directlry by runningpod installpod install
pod install
Conclusion
In this simple example I have shown you an example of re-installing Cocoapods or in short Pods by clearing cache and removing caching folders and files in a MacOS system environment.