Homebrew
Introduction
The Missing Package Manager for macOS (or Linux)
We have these cute little icons and pretend folders as part of our operating system and graphical user interface. But behind that, the “applications” (computer programs) are just programs – and those are made up of a bunch of files. Those collections of files are often referred to as “packages.”
Mac doesn’t have a native package manager to add, update, or remove these packages. So, some nice people stepped in and made one. Instead of being part of the GUI, you work with it through the command line.
The project's website
Open source projects usually have indepth directions on how to use them.
Head over there and see how it goes. Can you install it with just the information that is there?
Some things we'll use homebrew for
You do not need to install these right now. They’re just examples of a few things we’ll need.
-
Download an app programmatically (without the GUI)
You’re likely seeing this resource about homebrew because it’s the first day of writing HTML and we’re encouraging you to download a very simple text editor.
Let’s download BBEdit – but from the terminal. https://formulae.brew.sh/cask/bbedit
Imagine you got a new computer at work – and you didn’t want to spend three days setting it up. Maybe you could create a set of directions to run in your terminal that would download all the applications you need and set them up. Fancy.
Get it! (then check your /applications folder or search for BBEdit in spotlight)
-
Download an app you can't find in the app store anymore
It appears that the shortcut app we mentioned earlier Cheetsheet – isn’t maintained or available in an official capacity.
But there’s a stable version of it somewhere – and you can download it with brew.
https://formulae.brew.sh/cask/cheatsheet
(remember, you have to download homebrew before you can use it to download other software)
-
Install another language on your computer
Macs used to ship with programming/scripting languages like Python, Ruby, Perl, and PHP. But not everyone needs those, and there are other legal and licensing issues. So, the latest Macs don’t have these languages by default.
This way, we can just install what we need.
-
Switch between a version of an application
In some cases, you might need to access an older version of an application. Maybe you have a file that doesn’t open on the new version, and the company’s website doesn’t give you an option to download the old one.
-
You can also make your own programs
Homebrew is a way to distribute your own programs.
What does that crazy install command do?
Most people just paste it in and hit enter, and keep moving.
OK. Here’s the breakdown.
/bin/bash
: This invokes the Bash shell to run a command.-c
: This option tells Bash to read the command from the next string supplied, instead of from the standard input or from a file."$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
:curl
: A tool used to download files from a network.-fsSL
:-f
: Fail silently on server errors, useful for error handling.-s
: Silent mode, doesn’t show progress or error messages.-S
: When used with-s
, it allows showing errors if they occur.-L
: Follows redirects if the server responds with a redirect.
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
: URL to the raw shell script that installs Homebrew.
Most developers probably do not know what these things are doing. And that’s OK. You can’t know everything. And you don’t need to know everything either. If this becomes important, then great! Deal with it then.