# Homebrew — The Missing Package Manager for macOS and Linux > Homebrew is the missing package manager for macOS (and Linux). Installs CLI tools, libraries, and GUI apps (casks) that Apple or your Linux distro did not include. The de facto way developers set up their Mac development environment. ## Install Save in your project root: ## Quick Use ```bash # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` Common commands: ```bash brew install node # Install CLI tool brew install --cask firefox # Install GUI app brew upgrade # Upgrade all brew update # Update formulae list brew list # List installed brew search redis # Search brew info node # Package details brew uninstall node # Remove brew cleanup # Remove old versions brew doctor # Diagnose issues brew bundle dump # Export Brewfile brew bundle install # Install from Brewfile ``` Brewfile (version-control your setup): ```ruby # Brewfile tap "homebrew/bundle" brew "git" brew "node" brew "go" brew "rust" brew "fzf" brew "ripgrep" brew "bat" brew "eza" brew "zoxide" brew "starship" cask "visual-studio-code" cask "alacritty" cask "ghostty" cask "docker" cask "firefox" ``` ## Intro Homebrew is the missing package manager for macOS (and Linux). Created by Max Howell in 2009. Installs packages into their own directory and symlinks into `/usr/local` (Intel) or `/opt/homebrew` (Apple Silicon). Also manages GUI apps via Casks. Over 10,000 formulae and 8,000 casks available. - **Repo**: https://github.com/Homebrew/brew - **Stars**: 47K+ - **Language**: Ruby - **License**: BSD 2-Clause ## What Homebrew Does - **Formulae** — CLI tools and libraries (brew install) - **Casks** — GUI macOS applications (brew install --cask) - **Taps** — third-party repos for additional packages - **Bottles** — pre-built binaries for fast installs - **Brewfile** — declarative dependency management - **Auto-update** — background formula updates - **Cleanup** — remove old versions - **Doctor** — diagnose environment issues - **Linuxbrew** — works on Linux too ## Architecture Formulae are Ruby scripts describing how to download, build, and install a package. Bottles are pre-compiled binaries hosted on GitHub Packages (or Bintray). Homebrew stores everything under its prefix (`/opt/homebrew` on Apple Silicon) and symlinks into PATH. ## Self-Hosting Package manager — installs on user machine. ## Key Features - 10,000+ CLI formulae - 8,000+ GUI casks - Pre-built bottles (fast installs) - Brewfile for reproducible setups - Third-party taps - Works on macOS and Linux - Auto-update - `brew doctor` diagnostics - Version pinning - Bundle support ## Comparison | Manager | Platform | GUI Apps | Scope | |---|---|---|---| | Homebrew | macOS + Linux | Casks | General | | MacPorts | macOS | No | General | | apt | Debian/Ubuntu | Via snap | System | | dnf | Fedora/RHEL | Via flatpak | System | | Scoop | Windows | Yes | General | | Chocolatey | Windows | Yes | General | | Nix | Any | Yes | Reproducible | ## 常见问题 FAQ **Q: Intel vs Apple Silicon?** A: Apple Silicon 安装到 `/opt/homebrew`;Intel 安装到 `/usr/local`。Homebrew 自动检测。Rosetta 2 下可以跑 x86 Homebrew(但不推荐)。 **Q: 安全吗?** A: Homebrew 官方 formula 都经过 review。`brew audit` 检查合规。第三方 tap 安全性取决于 tap 维护者。 **Q: 怎么管理多版本?** A: `brew install node@18`、`brew link --overwrite node@18`。更复杂的版本管理用 mise、asdf 或 nvm。 ## 来源与致谢 Sources - Docs: https://docs.brew.sh - GitHub: https://github.com/Homebrew/brew - License: BSD 2-Clause --- Source: https://tokrepo.com/en/workflows/c457c879-3638-11f1-9bc6-00163e2b0d79 Author: AI Open Source