brew — macOS (and Linux) package manager via Homebrew across all 5 shells
Equivalents in every shell
brew install ripgrepHomebrew installs to `/opt/homebrew` on Apple Silicon, `/usr/local` on Intel Mac, `/home/linuxbrew/.linuxbrew` on Linux. Core verbs: `brew install <formula>` (CLI tools — installs to `bin/`); `brew install --cask <cask>` (GUI apps on macOS — `.app` bundles into `/Applications/`); `brew uninstall <formula>`; `brew update` (refresh formula definitions); `brew upgrade [<formula>]` (upgrade specific or all); `brew list` (installed); `brew search <q>` (find formulas); `brew info <formula>` (metadata + caveats); `brew doctor` (diagnose env). The "tap" concept: `brew tap <user>/<repo>` adds a third-party formula source.
brew install ripgrepSame Ruby-on-macOS external. macOS-default zsh (since Catalina) is the canonical Homebrew shell — every install tutorial assumes zsh. Shell setup hook: Homebrew's installer writes `eval "$(/opt/homebrew/bin/brew shellenv)"` to `~/.zprofile`; that sets `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR`, prepends `/opt/homebrew/bin` to `PATH`. If `which brew` fails after install, the shellenv line wasn't sourced (open a new terminal, or source `~/.zprofile` manually).
brew install ripgrepSame external. Fish-specific setup: instead of `eval "$(brew shellenv)"` (a bash idiom), use `eval (/opt/homebrew/bin/brew shellenv)` — fish's eval consumes the bash-style env exports. Better: add `/opt/homebrew/bin` to fish's `$fish_user_paths` once via `fish_add_path /opt/homebrew/bin` — survives shell restarts and is fish-idiomatic. Fish completions for `brew` ship with Homebrew via `brew --prefix`/`share/fish/`.
winget install BurntSushi.ripgrep.MSVCNo native PowerShell brew — Windows uses `winget` / `choco` / `scoop`. On macOS pwsh, `brew` works identically: `& brew install <pkg>` from pwsh shells out to the macOS-native brew binary. For genuine "install Mac apps from pwsh on macOS" use `& brew install --cask <cask>`. The Linux pwsh + Linuxbrew combination works the same way but is rare; on Linux pwsh, `apt` / `dnf` / `pacman` is more idiomatic per distro.
winget install BurntSushi.ripgrep.MSVCNo cmd-native equivalent. Windows alternatives: `winget` (official, since 2021), `choco` (community, broader Windows-app catalog, supports `--params` for installer flags), `scoop` (user-scope, no admin, focused on dev CLIs). `scoop install ripgrep` is the closest "developer-CLI-only" analog to `brew install ripgrep`. There is no native macOS-style Homebrew port to native Windows cmd — `brew` runs only on macOS (and Linux as Linuxbrew).
Worked examples
Install a CLI tool
brew install ripgrepbrew install ripgrepwinget install BurntSushi.ripgrep.MSVCchoco install ripgrep -yInstall a GUI application (macOS Cask)
brew install --cask iterm2brew install --cask iterm2winget install --id Microsoft.WindowsTerminalchoco install microsoft-windows-terminal -yUpdate Homebrew, upgrade all packages, clean up old versions
brew update && brew upgrade && brew cleanupbrew update; and brew upgrade; and brew cleanupwinget upgrade --allGotchas
- Apple Silicon vs Intel Mac install paths DIFFER — Apple Silicon (M1/M2/M3+) puts brew at `/opt/homebrew/`, Intel Macs use `/usr/local/`. Scripts that hard-code `/usr/local/bin/brew` break on M-series Macs. The canonical "find brew anywhere" is `$(command -v brew)`; tutorials that work on Intel Macs frequently fail silently on M-series until the user runs the shellenv eval. Note that the FIRST `brew install` on an M-series Mac initializes `/opt/homebrew/` and `git clone`s the formulas — takes ~2 minutes on a fresh system.
- `brew install --cask` on macOS installs GUI apps into `/Applications/`, but the app gets QUARANTINED — first launch shows "are you sure you want to open this from the internet" Gatekeeper dialog. The non-cask `brew install` of CLI tools doesn't hit this. To bypass quarantine for cask installs: `brew install --cask --no-quarantine <cask>` (or `xattr -dr com.apple.quarantine /Applications/<App>.app` after install).
- Homebrew on macOS is intentionally NOT root-owned — `/opt/homebrew/` is owned by your user, NOT `root`. Running `sudo brew install` is wrong and brew rejects it. This is a design choice: brew assumes one-user-per-Mac and avoids the security cost of root package installs. If you actually need a system-wide multi-user install with proper admin boundaries, brew is not the right tool — use `pkg` or `mas` (Mac App Store CLI) instead.
- `brew update` updates Homebrew itself + the formula definitions; `brew upgrade` actually upgrades installed packages. Same `update` vs `upgrade` confusion as apt. Common Friday-afternoon script: `brew update && brew upgrade && brew cleanup && brew doctor` — refresh, upgrade, prune old versions, sanity-check. Without the trailing `cleanup`, old keg versions accumulate in `/opt/homebrew/Cellar/` and can eat tens of GB over a year.
- Homebrew on Linux ("Linuxbrew", merged into Homebrew core in 2019) works but is rarely the right answer — your distro's apt/dnf/pacman has the package, usually faster + better integrated. Linuxbrew's sweet spot is dev tools NOT in your distro repos, on machines where you don't have root for apt/dnf. On WSL, prefer apt — Linuxbrew adds 1GB of dependencies and a separate user namespace for what apt already does.