HomeBrew
Homebrew is a free and open-source software package management system that tries to bridge the problem between macOS and Linux software. Originally designed for macOS but now also supports Linux as well (known as "Linuxbrew").
At its core, Homebrew helps you to install software not bundled to your operating system or to install a different version of software that replaces or sits alongside versions that are or were bundled.
Core Principlesβ
Homebrew installs software to a directory owned by the user, which means no sudo
is required. This is safer and more flexible.
Homebrew formulas (the package scripts) are Ruby scripts, which makes them easy to read and understand, even for those not familiar with Ruby.
Git-based: Homebrew leverages Git and GitHub to manage and track versions, making it easy to roll back when you break something.
Componentβ
Homebrew Core:
The central repository for software packages (are called "formulae").
Each one is a script that contains the instructions of how to install and compile a piece of software from source.
When you run a command like brew install wget, Homebrew fetches the formulae from wget --->> asks Homebrew Core to read its instructions: to compile and install
.
Caskβ
Is about extending the capability to macOS native applications with larger binaries, for GUIs and other software, for example, Google Chrome or VSC using Homebrew Cask.
Casks, unlike formulae, don't build from source. They pull precompiled binaries and install them.
Tapsβ
Anyone can create their own external "tap" with additional formulae or add third-party repositories. If there's a piece of software you want that isn't in Homebrew Core, You can add <user/repo>, and then you can install its formulae as if they were in Homebrew Core.
Bottles:
Compiling software from source is slow. Bottles are pre-compiled binaries to speed up the installation process.
Services
Homebrew can also manage background services, like databases or web servers, using brew services. This utility allows you to start, stop, and restart these services.
Other Utilities
brew cleanup: Removes older versions of installed formulae to free up space.
brew doctor: Checks your system for potential problems.
brew search: Searches for available formulae and casks.
brew update: Updates Homebrew itself and all the taps.
brew upgrade: Upgrades outdated formulae.
Whether you're a developer or just someone looking to manage software on your computer more efficiently, Homebrew has tools that can help.
Part 2
Homebrew's Shortfallsβ
For those unfamiliar with command-line interfaces, Homebrew can be intimidating. The need to understand various commands and their nuances might deter the less tech-savvy.
Dependency Issues
Homebrew installs software in its own directory (/usr/local by default on macOS). Formulae often have dependencies. While Homebrew tries to manage these, often leads to "dependency hell" everyone goes through this.
Bottles
While bottles (precompiled binaries) speed up installation, they often are unavailable for certain edge cases. This means users building from source, which can be time-consuming and can often fail for many reasons.
Updates Can Break Software
Running brew upgrade can sometimes break software if there are significant changes between versions or if there are changes in dependencies.
Disk Space Usage
Homebrew can consume a significant amount of disk space, especially if many packages are installed. The brew cleanup command can help, but it's another step users have to remember.
Limited to macOS and Linux
While there's a version of Homebrew for Linux (Linuxbrew), Windows users are left out. This can be a limitation for cross-platform teams or users who switch between operating systems.
Performance Overheadβ
Homebrew can add a noticeable overhead to shell startup times, especially if there are many taps or formulae installed. While Homebrew is sometimes up-to-date, its like construction things always lag.
Conclusionβ
While Homebrew offers a lot of conveniences and is a favorite among many macOS and Linux users, it's essential to be aware of its limitations. Like any tool, it's not a one-size-fits-all solution, and users should weigh its benefits against its potential pitfalls.