Remove or uninstall library previously added : cocoapods
The unwanted side effects of simple folder delete or installing over existing installation have been removed by a script written by Kyle Fuller - deintegrate and here is the proper workflow:
Install clean:
sudo gem install cocoapods-clean
Run deintegrate in the folder of the project:
pod deintegrate
Clean(this tool is no longer available):pod clean
Modify your podfile (delete the lines with the pods you don't want to use anymore) and run:
pod install
Done.
How to remove CocoaPods from a project?
Removing CocoaPods from a project is possible, but not currently automated by the CLI. First thing, if the only issue you have is not being able to use an xcworkspace
you can use CocoaPods with just xcodeproj
s by using the --no-integrate
flag which will produce the Pods.xcodeproj
but not a workspace. Then you can add this xcodeproj
as a subproject to your main xcodeproj
.
If you really want to remove all CocoaPods integration you need to do a few things:
NOTE editing some of these things if done incorrectly could break your main project. I strongly encourage you to check your projects into source control just in case. Also these instructions are for CocoaPods version 0.39.0
, they could change with new versions.
- Delete the standalone files (
Podfile
Podfile.lock
and yourPods
directory) - Delete the generated
xcworkspace
- Open your
xcodeproj
file, delete the references toPods.xcconfig
andlibPods.a
(in theFrameworks
group) - Under your
Build Phases
delete theCopy Pods Resources
,Embed Pods Frameworks
andCheck Pods Manifest.lock
phases. - This may seem obvious but you'll need to integrate the 3rd party libraries some other way or remove references to them from your code.
After those steps you should be set with a single xcodeproj
that existed before you integrated CocoaPods. If I missed anything let me know and I will edit this.
Also we're always looking for suggestions for how to improve CocoaPods so if you have an issues please submit them in our issue tracker so we can come up with a way to fix them!
EDIT
As shown by Jack Wu in the comments there is a third party CocoaPods plugin that can automate these steps for you. It can be found here. Note that it is a third party plugin and might not always be updated when CocoaPods is. Also note that it is made by a CocoaPods core team member so that problem won't be a problem.
How to remove library installed with CocoaPods?
In order to completely remove the imports from a previously built project try to clean
it first:
In Xcode:
⇧⌘K ( or Product
> Clean
)
This should clear the compiled code from within the projects release
or debug
directory:
/Library/Developer/Xcode/DerivedData/
/Build/(Release or Debug)
The compiler will often try to use code that it's already compiled during the build process if it can.
How to clear or clean specific pod from the local cocoapods cache
Clearing a specific pod
pod cache clean --all # will clean all pods
pod cache clean 'FortifySec' --all # will remove all installed 'FortifySec' pods
Sample output of pod cache clean 'FortifySec'
, for pods not using semantic versioning, this could result in many copies of same pod in cache:
pod cache clean 'FortifySec'
1: FortifySec v2.2 (External)
2: FortifySec v2.2 (External)
...
...
18: FortifySec v2.2 (External)
19: FortifySec v2.2 (External)
Which pod cache do you want to remove?
Complete cleanup (pod reset)
rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install
Example of pod cache list
prior to clean
pod cache list
FortifySec:
- Version: 2.2.1
Type: External
Spec: /Users/j.d/Library/Caches/CocoaPods/Pods/Specs/External/FortifySec/ui99sd....podspec.json
Pod: /Users/j.d/Library/Caches/CocoaPods/Pods/External/FortifySec/yi23sd...-sdjc3
- Version: 2.2.1
Type: External
Spec: /Users/j.d/Library/Caches/CocoaPods/Pods/Specs/External/FortifySec/dsfs-df23
Pod: /Users/j.d/Library/Caches/CocoaPods/Pods/External/FortifySec/dfs0d-2dfs
- Version: 2.2
Type: External
Spec: /Users/j.d/Library/Caches/CocoaPods/Pods/Specs/External/FortifySec/u78hyt....podspec.json
Pod: /Users/j.d/Library/Caches/CocoaPods/Pods/External/FortifySec/e000sd
- Version: 2.2.2
Type: External
Spec: /Users/j.d/Library/Caches/CocoaPods/Pods/Specs/External/FortifySec/s2d-df.podspec.json
Pod: /Users/j.d/Library/Caches/CocoaPods/Pods/External/FortifySec/ds34sd....
- Version: 2.2.1
Type: External
Spec: /Users/j.d/Library/Caches/CocoaPods/Pods/Specs/External/FortifySec/sdfsdfdsf....podspec.json
Pod: /Users/j.d/Library/Caches/CocoaPods/Pods/External/FortifySec/edfs5d7...
AFNetworking:
- Version: 2.5.3
Type: Release
Spec: /Users/j.d/Library/Caches/CocoaPods/Pods/Specs/Release/AFNetworking/2.6.podspec.json
Pod: /Users/j.d/Library/Caches/CocoaPods/Pods/Release/AFNetworking/2.6.3-4e7e2
Notice the multiple pod cache for - Version: 2.2.1
. It's a good idea to do so to get rid of unnecessary disk space used by pod cache.
How to remove one of the cocoa pods plugin from Xcode project
You have to edit the Podfile
($ emacs Podfile
in terminal.app) and remove the line pod 'nyximagekit'
from it. (ctrl+x
, ctrl+s
to save, then ctrl-x
, ctrl+c
to quit emacs
)
Once you did that, run pod update
and it will remove nyximagekit
from your project.
How do I remove my library from Cocoapods?
Add the deprecated_in_favor_of
attribute to the old specs you no longer want to maintain. This will notify users when they run pod install
that they should switch to the other spec. You'll need to submit a pull request to the specs repo with this change.
Related Topics
How to Remove Empty Cells in Uitableview
How to Simultaneously Satisfy Constraints, Will Attempt to Recover by Breaking Constraint
Uibutton Inside a View That Has a Uitapgesturerecognizer
Close iOS Keyboard by Touching Anywhere Using Swift
Issue Detecting Button Cellforrowat
Calling a Phone Number in Swift
How to Get the Color of a Pixel in a Uiimage With Swift
How to Flip Uiimage Horizontally
Missing Return Uitableviewcell
Detect Permission of Camera in iOS
Is There a Good Charting Library For Iphone
Changing Tint/Background Color of Uitabbar
Xcode 4: Create Ipa File Instead of .Xcarchive
Add Placeholder Text Inside Uitextview in Swift
How to Handle Background Audio Playing While iOS Device Is Locked or on Another Application