2 Installing and Using Homebrew
This chapter covers
- What a package manager is and why you need one
- Installing Homebrew on macOS
- Installing your first package (wget)
- Key Homebrew commands for daily use
- How Homebrew organizes files on your system
In the previous chapter, you learned to navigate your computer using the terminal. Now you will use that skill to install your first developer tool: Homebrew, a package manager for macOS. Every tool you install in this book — including Ollama, Python, and the VS Code editor — goes through Homebrew. Understanding how it works will save you significant time and frustration throughout the rest of the book.
2.1 What Is a Package Manager? The App Store for Developers
When you want to install an app on your iPhone, you go to the App Store. You search for the app, tap Install, and it downloads and sets itself up. You never worry about where the files go or what other software the app needs.
A package manager is the same idea, but for the terminal. Instead of clicking Install in a store, you type a command. Instead of apps with icons, you install packages -- programs, libraries, or tools that developers use.
The package manager we will use is called Homebrew. It is a widely used package manager for macOS, especially in developer workflows.
2.1.1 Why Not Just Download from Websites?
You could download developer tools from their websites manually. But there are three problems with that approach: