38

Here is a link to Carthage:

https://github.com/Carthage/Carthage

It additionally adds some changes in project files so I can simply remove extra files/folders and it will work but I can't use Carthage in future again because of some errors.

And of course there is no concrete instruction how to do it on its official page.

pkamb
  • 33,281
  • 23
  • 160
  • 191
Vyachaslav Gerchicov
  • 2,317
  • 3
  • 23
  • 49

3 Answers3

46

To completely remove Carthage and its frameworks from project:

  1. In Finder, delete these files and directory from your project's root folder:

     Cartfile
     Cartfile.resolved
     Carthage/
    
  2. In Xcode, delete the framework item in the project navigator.

  3. In Xcode > project Target > Build Phases tab (illustration), delete the carthage copy-frameworks Run Script (if you had previously added it).

You can always download the framework you need from github and add it back in manually. (Or follow @tfrank377's answer).

See also

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
29

Removing Carthage has actually been pretty easy for me.

  1. I simply copy my frameworks from the Carthage folder into a frameworks folder I have in my main project folder.
  2. Make sure they are added back to the Xcode project from their new location.
  3. Search the entire project in Find navigator for references to Carthage. The only ones I found were in the Frameworks search paths under Build Settings. As long as you have a reference to your non-Carthage frameworks folder, you should be able to delete the Carthage references.
  4. Lastly, remove the copy-frameworks run script put in place to keep your Carthage frameworks up to date. Simply click the x in the top right run script phase xcode

You should always be able to add Carthage back if you want, but these steps should remove it from a particular Xcode project, while keeping the frameworks you want.

tfrank377
  • 1,858
  • 2
  • 22
  • 34
  • your answer was helpful, btw its said that "copy-frameworks is helper script using which, Frameworks are copied only once. There are no checks to copy a framework again once it changes. This means that updated dependencies might not be picked up until you perform a clean build." to where the frameworks are copied? – Saif Aug 22 '19 at 11:12
  • Got it!, frameworks are copied to .app (application file) from Carthage/Build/iOS folder. So there is no way to get updated framework in .app file until we clean the build. – Saif Aug 22 '19 at 11:45
1

I have almost spent a week and now can say to remove Carthage safely and without any side effects there are following step by step process

  1. It's better to do it step by step, means if you have installed four (4) frameworks using Carthage just go by removing one framework at a time and after each removal successfully build and run on device and simulator to see the final result. And even if you need any framework out of those 4 first delete, clean your project and then reinsert the needed framework in your project using another mechanism you want.
    1. From ProjectNavigator > Build Phases remove the reference of the framework
    2. From Cartfile & Cartfile.resolved remove all references of the frameworks and save
    3. Remove Framework from the left-hand side of the project navigator (where you see the entire file structure) by selecting the framework and pressing delete. On being given the option by Xcode select remove all references
    4. Go to terminal and cd/Path to. your project
    5. Run the command Carthage update --platform iOS (platform you have to choose as per what project is meant for so if iOS select iOS or else select as per your choice)
    6. Let the Carthage download all dependencies again
    7. Build & Run
    8. Repeat steps from 2 to 8 till you have no framework left
    9. Search in Finder a).Cartfile b).Cartfile.resolved c). Carthage/

Delete all of these and again clean and build your project.

Nikhil Pandey
  • 262
  • 4
  • 11