Uninstall/remove Carthage from iOS/Xcode project?
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
- 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.
- From ProjectNavigator > Build Phases remove the reference of the framework
- From Cartfile & Cartfile.resolved remove all references of the frameworks and save
- 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
- Go to terminal and cd/Path to. your project
- 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)
- Let the Carthage download all dependencies again
- Build & Run
- Repeat steps from 2 to 8 till you have no framework left
- Search in Finder a).Cartfile b).Cartfile.resolved c). Carthage/
Delete all of these and again clean and build your project.
Removing Carthage has actually been pretty easy for me.
- I simply copy my frameworks from the Carthage folder into a frameworks folder I have in my main project folder.
- Make sure they are added back to the Xcode project from their new location.
- 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.
- 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
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.
To completely remove Carthage and its frameworks from project:
In Finder, delete these files and directory from your project's root folder:
Cartfile Cartfile.resolved Carthage/
In Xcode, delete the framework item in the project navigator.
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
- Carthage Tutorial: Getting Started
- Carthage documentation