Getting Started with Homebrew for macOS

If you have a Mac, Homebrew’s got your back…(get it? Mac, Back)

Note: Homebrew is currently only for macOS, for the Linux Version check out Linuxbrew


What are package managers?

On of the most essential things in today's world of development are Package Managers. Well, what are these “Package Managers” you speak of you might ask. Package Managers greatly simplify the process of getting and installing Packages. They also make updating, cleaning, symlinking and Uninstalling packages an absolute breeze.

Imagine instead of having to go to all those “Install” sites that are filled to the brim with decisive ads that install malware onto your device, you can just run a simple “Install” command on the Command Line (terminal) and BOOM, you get the whole package installed perfectly.

the usual scammy download websites

Believe it or not this can be done super simply by just running a command like the sort:

installing python with homebrew

What is Homebrew and what can I do with it?

So, what is Homebrew? Homebrew is simply just a Package Manager (arguably the best one there for macOS) that allows you to install


Prerequisites

  • Terminal (comes preinstalled on Mac)
  • Ruby (Also comes preinstalled on Mac)

Installation

Ok, so done with all the jibber jabber, let's get to the exciting part, Installing Homebrew!

Ok, so to get started you need to open up terminal on your Mac. You can do this by either using spotlight search and searching ‘Terminal’ (or any Shell Utility such as my personal favorite, iTerm 2) then paste the following command that installs Homebrew onto your system:

Follow through the interactive installation set up, then you’ll be all set!

The next step is to actually install utilities! You can install utilities by just simply running the following into the terminal: “brew install <formula>” (formulae are just packages). So for example here is how you would install git using brew:

Check out the packages that are avalible to download with Brew: http://braumeister.org/

Here are some of the things I personally install right away:

  • Git (brew install git)
  • Ruby (brew install ruby)
  • Node — comes with npm (brew install node)
  • Python(2) — comes with pip (brew install python)
  • Python(3) — comes with pip3 (brew install python3)

Even though some of these (such as Ruby and Python) come preinstalled on Mac, I prefer to


Homebrew Cask for Applications

The Ultimate Companion to the Ultimate Package Manager

UPDATE: Removed installing homebrew cask instructions as it is now bundled with brew (just a brew update will suffice!)

You might want to use the awesomeness and simplicity of Homebrew to install Graphical Applications (such as Google Chrome, Slack, iTerm 2 etc…) and there is an awesome project just for that! Its called Brew Cask!

Run the following code snippet to install Brew Cask:

You’re all set to go!

The awesome thing about brew cask is that it automatically symlinks the application into your /Applications folder for you, so no more drag and drop to install!

Brew Cask runs on top of Brew, so to access it you need to do “brew cask <command> <formula>”, not just “cask <command> <formula>

Some useful formulae to install using Cask:

  • Google Chrome (brew cask install google-chrome)
  • Slack (brew cask install slack)
  • iTerm 2 — my favorite Terminal!(brew cask install iterm2)

To be able to install “versioned” applications (betas and others of the sort) you just have to run the following command:

Now, you can install many different applications such as:

  • iTerm 2-beta (brew cask install iterm2-beta)
  • Google Chrome Canary — dev and beta version also available (brew cask install google-chrome-canary)

Sorry if this Brew Cask guide is very barebone, I plan on having another article only about Brew Cask!


Tips and Tricks for Homebrew

Nifty little things I wish I knew when I started using Brew

  • Always run “brew update” to pull latest updates from Homebrew (gets updates very frequently)
  • If you are having problems with Homebrew run “brew doctor” and it will tell you all the problems it is having.
  • After installing new packages, updating packages, or uninstalling packages, always run “brew cleanup” so brew can clean after itself and clear memory space. What “brew cleanup” does is it just removes the old outdated packages that are still on your memory!


Wrap Up

Let's wrap it up tighter than a Falafel Wrap

Thank you all so much for reading my article, and be sure to drop a comment about the article (doesn't necessarily have to agree with my views!) so we can all have an awesome time and a memory full discussion!

With lots of ❤, Zakaria

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.