1. First install Brew
The installation commands are as follows:
CURL-LSSF Http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz-c/usr/local--strip 1
Then execute the following command to get the latest version:
Brew Update
When the brew installation is successful, you can install the software you want, such as Carthage, as follows:
sudo brew install Carthage
If you uninstall, the command is as follows:
sudo brew uninstall Carthage
But this time the installation may report the following error (newly bought computer ...) )
Error:could not Create/usr/local/cellar
Error:permission denied-/library/caches/homebrew/formula/carthage.brewing
Workaround:
Resolve the first error
1, command: sudo chown-r $USER/usr/local
Resolve the second error
2, command: sudo chown-r $USER/library/caches/homebrew/
The final brew install Carthage will wait for the installation to be done silently.
================================================
Next, let's briefly introduce the Brew and Carthage
Brew, also known as homebrew, is the software package management tool on Mac OSX, it can easily install software or uninstall software in Mac, it is very convenient to use only one command.
Brew similar to the Apt-get functions of Ubuntu system
Installing Brew
Brew's official website: http://brew.sh/A detailed description of the use of Brew on the official website
Other Brew commands
Brew List lists installed software
Brew Update Update Brew
Brew Home opens Brew's official website with a browser
Brew Info Displays software information
Brew Deps Show Package dependencies
Carthage's goal is to manage the cocoa third-party framework in the simplest way.
The basic workflow is as follows:
Create a cartfile that contains a list of frames that you want to use in your project
Run Carthage and you will get the frames listed and compile them
Drag-and- .framework
drop the compiled binaries into your Xcode project
Carthage compiles your dependencies and provides a framework for the binaries, but you still retain complete control over the structure and settings of the project. Carthage does not automatically modify your project files or compile settings.
the difference between Carthage and Cocoapods
1, cocoapods default will automatically create and update your application and all dependent Xcode workspace,carthage used xcodebuild
to compile the framework's binary files
2. The Cocoapods method is easier to use, but the Carthage is more flexible and non-invasive.
3, Cocoapods project must also contain a podspec
file, which is the project's metadata, and determine how the project is compiled, Carthage use xcodebuild
to compile dependencies
4. Carthage does not have a list of total items, which reduces maintenance and avoids any problems with centrality (such as a central server outage)
Summary: If you use a tool as simple as possible then Carthage it, the Cocoapods function is relatively more, but the use is also relatively troublesome (personal or like to use the Cocoapods)
Start using:
Create a cartfile to list the frames you want to use
Run carthage update
, will get the dependent file into a Carthage.checkout
folder and then compile each dependent
In the "General" Settings tab of your application target, in the "Embedded Binaries" area, drag the frame from the Carthage.build
folder.
In this process, Carthage will create some build artifacts, the most important of which is the Cartfile.lock
file, which will list the specific version of each frame, ensuring that you submit the file to the version control tool (like Git, SVN), Because everyone who uses the project needs it to compile the same version of the framework.
By completing the steps above and submitting your changes, the other users of the project simply need to get the repository and execute carthage bootstrap
it to use the framework you added.
Brew, Carthage Installation