The brew install command is used to install software on your computer.
This command is pretty useful because it makes it easy to get the software you need.
When you run brew install it looks for the software you want. Then it downloads it.
Then it installs the software on your computer.
The brew install command also takes care of any software that is required for the software you are installing to work properly.
For example if the software you are installing needs software to run brew install will download and install that software too.
So brew is a handy tool to have on your computer.
You can use brew install to install all sorts of software like text editors and programming tools.
So the time you need to install some software you can use brew install to do it.
The brew install command is a help when you are working with software on your computer.
Most developers use Homebrew every day. Very few people actually think about what Homebrew is really doing. Homebrew looks like a package manager to them. Homebrew feels like apt or yum when they use it.. Inside Homebrew it does things in a very different way. Homebrew behaves a lot, like Git when it is working. Homebrew also does things like a build system. It keeps the filesystem in order.
When you finally get it a lot of things that your system does will start to make sense. You will be able to figure out a lot of system problems that seemed weird before like why your system stopped working.
Let us open the hood.
Homebrew is not something that installs things for you. Homebrew is actually a place where you can find things to build. Think of Homebrew as a list of things you can build on your computer. Homebrew is, like a registry that keeps track of all the things you can build.
When you run
brew install docker
It does not mean that you should download Docker and then put it somewhere on your computer. Docker is not something that you can just download and place anywhere.
What this thing really means is:
“Look up a build recipe for Docker, find a verified binary (or source), install it into a versioned directory, and expose it through symlinks.”
Homebrew is actually like a place where you can find and manage builds from the source rather than what you would normally think of as a package manager. Homebrew is really good, at keeping track of all the builds you have kind of like a big library of stuff you have put together yourself.
Every package is defined by a formula that is written in Ruby. This formula is stored in a Git repository called homebrew-core. The homebrew-core repository contains things like:
Where to download the binary
What checksum should the file have? The correct checksum, for the file is important to know. We need to find out what checksum the file should have.
When we are talking about something that needs to be built or unpacked the first thing that comes to my mind is that we should have a set of instructions.
The instructions for building or unpacking the thing should be easy to understand.
The Cellar: Homebrew’s real filesystem
Everything Homebrew installs goes into one place:
/opt/homebrew/Cellar
(on Apple Silicon Macs)
Inside that directory, every package gets its own folder:
/opt/homebrew/Cellar/docker/29.1.5/
That folder contains the real Docker binary and everything it depends on. Homebrew never mutates it. That directory is immutable. If you install a new version, you get a new directory:
/opt/homebrew/Cellar/docker/29.1.6/
Nothing overwrites anything. No files are replaced in place. This is a huge design choice — and it’s why Homebrew is so safe.
How commands appear in your PATH
You don’t run binaries from the Cellar directly. Instead, Homebrew creates symlinks:
/opt/homebrew/bin/docker → ../Cellar/docker/29.1.5/bin/docker
Your shell sees /opt/homebrew/bin in PATH, so when you type docker, it follows the symlink to the correct version.
When you upgrade Docker, Homebrew just moves the symlink to point to the new directory. The old version is still there, untouched.
This is why Homebrew supports instant rollbacks:
brew switch docker 29.1.5
All it does is change symlinks.
No files are copied. Nothing is rebuilt.
Why Homebrew almost never corrupts your system
Because Homebrew never installs into:
/usr/bin
/bin
/lib
system frameworks
Everything lives under /opt/homebrew.
That’s not an accident — it’s a safety boundary. If something breaks, you can literally delete /opt/homebrew and your OS is still intact.
Bottles vs source builds
When Homebrew can, it downloads a bottle — a precompiled binary built by the Homebrew maintainers. That’s why installs are fast.
If no bottle exists for your OS + CPU combo, Homebrew falls back to compiling from source using the instructions in the formula. Same recipe, different execution path.
Either way, the result still lands in the Cellar.
TL;DR;
Homebrew looks simple because Homebrew is actually hiding a deliberate architecture. The people who made Homebrew did a lot of thinking about how Homebrew should work. They wanted Homebrew to be easy to use so they made sure that the complicated parts of Homebrew are not visible, to the user. This means that Homebrew has a lot of things going on behind the scenes that you do not see when you use Homebrew.
Top comments (0)