Prodtyping

The process on turning ideas into reality

January 14th 2019

Getting started with Homebrew

When I first attempted to learn how to program I was very lucky to have an extremely smart and experienced developer set up my machine to get me started. Our first step was installing Homebrew. 

No, not that kind of homebrew 😅(Photo by Lance Anderson on Unsplash)

Homebrew is a package manager for OSX designed to make life easier. Package managers handle all the installation and dependency stuff for you. As a beginner, this was a vital lesson to be learned. Learning to program can sometimes look more like 70% configuration and about 30% coding. Especially in the beginning. So when I found out that there are tools out there to make the configuration easier I held on and praised the smarter people who came before me. 

So before we dive into our little tutorial for Homebrew, let's talk about packages. 

Not those kind of packages.. (Photo by chuttersnap on Unsplash)

A package is a bundle of installable source code. If you wanted to download a package manually it can get a little tricky because sometimes there are dependencies (software that relies on other software to operate) that are needed for a successful installation. After the package has been successfully installed keeping it up to date manually can be difficult as well. 

There are many different package managers some handle packages in binary form and some are source code based. There are system and language package managers as well. 

So what is Homebrew? 

Homebrew is "the missing package manager for macOS" since there is no built-in package manager for macOS. It's a free and open-source software package management system and was created by Max Howell. Homebrew makes it easy to install command line software and tools on a Mac.

To get started all you need is to copy and paste this script into your terminal

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

Then make sure that brew is running properly

brew doctor

For more information visit https://docs.brew.sh/ or use 

brew man


Homebrew relies on a git repository that stores the formulaes to install various packages. In our examples Replace with the name of the package you want to install.


Install open-source packages

Search 

brew search <name>

Download and install that package

brew install <name>

Remove that package from your system later

brew remove <name>

Install graphical apps

Search for a graphical app

brew cask search <name>

Install an app use (This will automatically download, extract the app, and install it to your Applications folder)

brew cask install <name>

Uninstall an app with Homebrew Cask

brew cask uninstall <name>

Update my local packages

First, update the formulae and Homebrew itself

brew update

See what is outdated

brew outdated

Upgrade everything 

brew upgrade

Upgrade a specific formula

brew upgrade <name>

Stop a formula from being updated

Stop something from being updated/upgraded:

brew pin <name>

Allow that formula to update again:

brew unpin <name>

Uninstall old versions of a formula

By default, Homebrew does not uninstall old versions of a formula.

brew cleanup <name>

Clean up everything at once

brew cleanup

See what would be cleaned up:

brew cleanup -n

Uninstall a formula

Remove a formula entirely (be careful with this one!)

brew uninstall --force <name>

Where does stuff get downloaded?

brew --cache Which is usually: ~/Library/Caches/Homebrew

Uninstall Homebrew

To uninstall Homebrew, paste the command below in a terminal prompt.

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

An illustrated guide on that other kind of homebrew 🍻

This tutorial leaves out how to make your own formulas but it should be enough to get a basic understanding of why Homebrew is useful and how to get started. Cheers!