Hola Amigos 🙂

If you are using Mac and are Open Source enthusiast or a developer or want to install any open source packages that are available for Linux-based OS’s through your Terminal.App rather than compiling and installing from source. Well don’t worry HomeBrew comes to your rescue.

In this post, I am going to tell you how to set up Homebrew easily. You might want to have a good internet connection if you are not that patient in waiting, as this is going to download quite a large amount of files on your machine.

What is Homebrew?

It is an alternative version for Mac OS X of apt-get or aptitude that you use in Linux-based systems. It is a command line tool that will install the missing packages from the source that are not available through Mac App Store. It enables you to install latest development tools like wget, git, mysql, python3, and many more easily through your Terminal.App just like you used to do with Linux terminal.

They are simple formulas written using Ruby script so that the packages are easily installed into Mac OS X. It also installing them under a different directory so there is no need to worry about the default packages being replaced or conflict between the default and homebrew versions.

Eg: wget formulae sample

require "formula"

class Wget < Formula
  homepage "http://www.gnu.org/software/wget/"
  url "http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz"
  sha1 "f3c925f19dfe5ed386daae4f339175c108c50574"

  def install
    system "./configure", "--prefix=#{prefix}"
    system "make", "install"
  end
end

Here the source of wget is fetched from the source and it will automatically run .configure, make, make install for you and saving you the work of executing these commands.

Let me put this in simple terms, homebrew will take the package name as an argument from the user and will fetch the source of the appropriate package from git (or ftp, wherever the package is hosted) run .configure with appropriate arguments, make, make install; and make installing packages simpler for the user. It is basically ruby scripts executing the command line (terminal) commands for you 🙂

Installing Homebrew:


<del>ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"</del>

Updated link:


ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This command will download the homebrew ruby gem(package written in ruby) using curl, a command line tool (included by default in Mac) for transferring data just like wget. After the download is complete it will execute the package using “ruby -e” (-e being the execution argument for ruby).

It will pause in between installation and tell you about what it is going to do. While using ‘brew install’ too you can see each and every step that the command executes and you can know what is going on behind the curtains (one of my favorite features).

After Installation run:


brew update

This will make sure that you have the updated brew repository and the latest packages are available.

brew update terminal log
brew update terminal log

P.S: There is MacPorts too that you can use, but I would recommend you to use homebrew as lots of technologies are having steps to install latest packages using homebrew.

Reference:

brew.sh

Let the Windows be open, and feel the Freedom.

Advertisement

3 thoughts on “Setting up HomeBrew on Mac OS X

Leave a Reply to Jackson Isaac Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s