Merge pull request #19304 from colindean/eval-brew-shellenv-in-docs

Adds post-installation steps to installation with extend version in tips
This commit is contained in:
Mike McQuaid 2025-02-19 19:00:53 +00:00 committed by GitHub
commit 7c68be8e7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View File

@ -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`. 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
Uninstallation is documented in the [FAQ](FAQ.md#how-do-i-uninstall-homebrew). Uninstallation is documented in the [FAQ](FAQ.md#how-do-i-uninstall-homebrew).

View File

@ -140,3 +140,14 @@ export HOMEBREW_ARTIFACT_DOMAIN=https://artifacts.example.com/artifactory/homebr
export HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK=1 export HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK=1
export HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN="$(printf 'anonymous:' | base64)" 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)"
```