As a developer, we always are in the need to install libraries to compile our code, or as dependencies of some other software that we use. Take as example a PHP extension (if you use the version shipped with OS X): you will have to download the source code for it, phpize it, and then configure and install the extension. Or maybe, you come from the Linux world and (like me) like to spend a lot of time and feel more productive in the Terminal, you’ll notice how difficult it is to have elementary packages running, like wget or htop.
Homebrew is the easiest way to accomplish those cases above, and even more! It isn’t the only option out there (MacPorts and Fink are its competitors) but it is definitively the most popular one.
Install Xcode
First of all, you will have to install Xcode app, which is the IDE to develop Apple software for Apple devices.
Once it is downloaded, you need to open Xcode to agree with the licence and after that, it will install final components.
After this, you have to install the Command Line Tools (it gives terminal users many commonly used tools, utilities, and compilers, including make, GCC, git, libtool, cpp, what, and many other useful commands that are usually found in default Linux installations):
xcode-select –install
Install Homebrew
Once the dependencies are covered, you can install Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and that’s it! In a single command you are giving such power to your terminal. Before install any package with, it is better to check that everything is set up for Homebrew, and for that you can use this command:
brew doctor
After this, you’re ready to go. For example, to install wget package,what you only need to do will be:
brew install wget
and once it finish, you will be able to download resources using wget command.
You can search for packages to install with the command
brew search PACKAGE_NAME
List the ones there are installed in your OS X with
brew list
And, as any other package manager, you can keep your installed packages up to date with
brew update
Or, for a specific package with
brew update PACKAGE_NAME
With those basic commands, you are good to go, but if you want to go deeper with this tool, you type
man brew
To check everything Homebrew has to offer, and of course, there’s its website where you can find the online documentation.