Skip to content

Commit

Permalink
Merge pull request #19304 from colindean/eval-brew-shellenv-in-docs
Browse files Browse the repository at this point in the history
Adds post-installation steps to installation with extend version in tips
  • Loading branch information
MikeMcQuaid authored Feb 19, 2025
2 parents 8ca80ae + dfbc931 commit 7c68be8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,26 @@ Make sure you avoid installing into:

Create a Homebrew installation wherever you extract the tarball. Whichever `brew` command is called is where the packages will be installed. You can use this as you see fit, e.g. to have a system set of libs in the default prefix and tweaked formulae for development in `~/homebrew`.

## Post-installation steps

When you install Homebrew, it prints some directions for updating your shell's config.
If you don't follow those directions, Homebrew will not work.

You need to update your shell's config file (which file exactly depends on your shell, for example `~/.bashrc` or `~/.zshrc`) to include this:

```sh
eval "<Homebrew prefix path>/bin/brew shellenv)"
```

Replace `<Homebrew prefix path>` with the directory where Homebrew is installed on your system.
You can find Homebrew's default install location [in this FAQ entry](https://docs.brew.sh/FAQ#why-should-i-install-homebrew-in-the-default-location).

For more insight, re-run the installer or inspect [the installer's source](https://github.com/Homebrew/install/blob/deacfa6a6e62e5f4002baf9e1fac7a96e9aa5d41/install.sh#L1072-L1088)
to see how the installer constructs the path it recommends.

See [Tips N' Tricks > Loading Homebrew from the same dotfiles on different operating systems](Tips-N'-Tricks.md#loading-homebrew-from-the-same-dotfiles-on-different-operating-systems)
for another way to handle this across multiple operating systems.

## Uninstallation

Uninstallation is documented in the [FAQ](FAQ.md#how-do-i-uninstall-homebrew).
Expand Down
11 changes: 11 additions & 0 deletions docs/Tips-N'-Tricks.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,14 @@ export HOMEBREW_ARTIFACT_DOMAIN=https://artifacts.example.com/artifactory/homebr
export HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK=1
export HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN="$(printf 'anonymous:' | base64)"
```

## Loading Homebrew from the same dotfiles on different operating systems

Some users may want to use the same shell initialization files on macOS and Linux.
Use this to detect the likely Homebrew installation directory and load Homebrew when it's found.
You may need to adapt this to your particular shell or other particulars of your environment.

```sh
command -v brew || export PATH="/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin"
command -v brew && eval "$(brew shellenv)"
```

0 comments on commit 7c68be8

Please sign in to comment.