How to remove CocoaPods from a project?

前端 未结 19 1328
深忆病人
深忆病人 2020-11-22 05:17

What\'s the right way of removing CocoaPods from a project? I want to remove the whole CocoaPod. Due to some limitations imposed by my client I can\'t use it. I need to have

相关标签:
19条回答
  • 2020-11-22 05:57

    Use these Terminal's commands (Don't forget to use sudo at the beginning of new lines):

    open:YourDir YouName$ sudo gem uninstall cocoapods
    Password:?
    Remove executables:
        pod, sandbox-pod
    
    in addition to the gem? [Yn]  Y
    Removing pod
    Removing sandbox-pod
    Successfully uninstalled cocoapods-1.4.0
    open:YourDir YourName$ gem list --local | grep cocoapods
    cocoapods-core (1.4.0)
    cocoapods-deintegrate (1.0.2)
    cocoapods-downloader (1.1.3)
    cocoapods-plugins (1.0.0)
    cocoapods-search (1.0.0)
    cocoapods-stats (1.0.0)
    cocoapods-trunk (1.3.0)
    cocoapods-try (1.1.0)
    

    Uninstall the list one by one like this:

    open:YourDir YourName$ sudo gem uninstall cocoapods-core
    Successfully uninstalled cocoapods-core-1.4.0
    open:YourDir YourName$ sudo gem uninstall cocoapods-trunk
    Successfully uninstalled cocoapods-trunk-1.3.0
    open:YourDir YourName$ sudo gem uninstall cocoapods-try
    Successfully uninstalled cocoapods-try-1.1.0
    open:YourDir YourName$ gem list --local | grep cocoapods
    open:YourDir YourName$ sudo gem uninstall cocoapods-stats
    Successfully uninstalled cocoapods-stats-1.0.0
    open:YourDir YourName$ sudo gem uninstall cocoapods-search
    Successfully uninstalled cocoapods-search-1.0.0
    open:YourDir YourName$ sudo gem uninstall cocoapods-downloader
    Successfully uninstalled cocoapods-downloader-1.1.3
    open:YourDir YourName$ sudo gem uninstall cocoapods-plugins
    Successfully uninstalled cocoapods-plugins-1.0.0
    open:YourDir YourName$ gem list --local | grep cocoapods
    cocoapods-deintegrate (1.0.2)
    open:YourDir YourName$ sudo gem uninstall cocoapods-deintegrate
    Successfully uninstalled cocoapods-deintegrate-1.0.2
    open:YourDir YourName$ sudo gem uninstall cocoapods-stats
    Successfully uninstalled cocoapods-stats-1.0.0
    open:YourDir YourName$ sudo gem uninstall cocoapods-search
    Successfully uninstalled cocoapods-search-1.0.0
    open:YourDir YourName$ sudo gem uninstall cocoapods-downloader
    Successfully uninstalled cocoapods-downloader-1.1.3
    open:YourDir YourName$ sudo gem uninstall cocoapods-plugins
    Successfully uninstalled cocoapods-plugins-1.0.0
    open:YourDir YourName$ gem list --local | grep cocoapods
    cocoapods-deintegrate (1.0.2)
    open:YourDir YourName$ sudo gem uninstall cocoapods-deintegrate
    Successfully uninstalled cocoapods-deintegrate-1.0.2
    
    0 讨论(0)
  • 2020-11-22 05:58

    I was able to remove my pods in the project using the CocoaPods app (Version 1.5.2). Afterwards I only deleted the podfile, podfile.lock and xcworkspace files in the folder.

    0 讨论(0)
  • 2020-11-22 05:59

    pod deintegrate and pod clean are two designated commands to remove CocoaPod from your project/repo.

    Here is the complete set of commands:

    $ sudo gem install cocoapods-deintegrate cocoapods-clean
    $ pod deintegrate
    $ pod cache clean --all
    $ rm Podfile
    

    The original solution was found here: https://medium.com/@icanhazedit/remove-uninstall-deintegrate-cocoapods-from-your-xcode-ios-project-c4621cee5e42#.wd00fj2e5

    CocoaPod documentation on pod deintegrate: https://guides.cocoapods.org/terminal/commands.html#pod_deintegrate

    0 讨论(0)
  • 2020-11-22 06:00

    I think there's a more easy way to do that.

    As edited by the accepted answer, now you can use a third party plugin cocoapods-deintegrate, it's reliable because its made by a CocoaPods core team member.

    But,there're still some files remain:

    Podfile
    Podfile.lock
    Workspace
    

    You could remove them from your project manually,but there's also another tool for helping you to clean them, thanks cocoapods-clean.

    Finally, the uninstallation work is still not completed, cocoapods-clean don't clean the Podfile, just run:

    rm Podfile
    

    Cheers!

    Before removing you should ensure you have a backup of your project!

    0 讨论(0)
  • 2020-11-22 06:01

    I tried all these answers but it still wouldn't build, eventually I tried:

    pod deintegrate
    pod install
    

    which actually worked!

    It's like it needs to remove all the pod scripts from your build phases and re-add them back in for it to work, at least in my case.

    0 讨论(0)
  • 2020-11-22 06:03
    $ sudo gem install cocoapods-deintegrate cocoapods-clean
    $ pod deintegrate
    $ pod clean
    $ rm Podfile
    
    0 讨论(0)
提交回复
热议问题