One can inspect the list of files installed by a Homebrew formula via brew list -f <formula_name>. In this case, the output should like
> brew list -f z
/usr/local/Cellar/z/1.9/etc/profile.d/z.sh
/usr/local/Cellar/z/1.9/INSTALL_RECEIPT.json
/usr/local/Cellar/z/1.9/README
/usr/local/Cellar/z/1.9/share/man/man1/z.1
Note that in this case there's no command (and not even bin), just a z.sh. This makes sense because z is a shell tool, and have to be sourced into the shell as functions to get and set the shell environment; running as an external command simply doesn't offer deep enough integration. Therefore, you have to source z.sh into your shell, probably in .bash_profile, .bashrc, or .zshrc.
Usually, Homebrew formulae that require post-installation interactions in order to be usable will have instructions listed in caveats, which will be shown post-install, or manually retrieved via brew info <formula_name>. In this case,
> brew info z
<irrelevant info omitted>
==> Caveats
For Bash or Zsh, put something like this in your $HOME/.bashrc or $HOME/.zshrc:
. `brew --prefix`/etc/profile.d/z.sh
Of course you should take that advise with a grain of salt, and use more modern and human-readable shell syntax:
source "$(brew --prefix)/etc/profile.d/z.sh"
Or
source /usr/local/etc/profile.d/z.sh
if you know your Homebrew installation is in /usr/local.
Videos
One can inspect the list of files installed by a Homebrew formula via brew list -f <formula_name>. In this case, the output should like
> brew list -f z
/usr/local/Cellar/z/1.9/etc/profile.d/z.sh
/usr/local/Cellar/z/1.9/INSTALL_RECEIPT.json
/usr/local/Cellar/z/1.9/README
/usr/local/Cellar/z/1.9/share/man/man1/z.1
Note that in this case there's no command (and not even bin), just a z.sh. This makes sense because z is a shell tool, and have to be sourced into the shell as functions to get and set the shell environment; running as an external command simply doesn't offer deep enough integration. Therefore, you have to source z.sh into your shell, probably in .bash_profile, .bashrc, or .zshrc.
Usually, Homebrew formulae that require post-installation interactions in order to be usable will have instructions listed in caveats, which will be shown post-install, or manually retrieved via brew info <formula_name>. In this case,
> brew info z
<irrelevant info omitted>
==> Caveats
For Bash or Zsh, put something like this in your $HOME/.bashrc or $HOME/.zshrc:
. `brew --prefix`/etc/profile.d/z.sh
Of course you should take that advise with a grain of salt, and use more modern and human-readable shell syntax:
source "$(brew --prefix)/etc/profile.d/z.sh"
Or
source /usr/local/etc/profile.d/z.sh
if you know your Homebrew installation is in /usr/local.
in Mac osx with iterm2 with zsh just put:
First:
vim ~/.zshrc
and add this line (or just add z)
plugins=(
git
z
)
exit with
:x!
that's it.
This worked for me on macOS ARM (Apple M1):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
and then:
export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc
Try setting this line in your .zshrc
export PATH=/usr/local/bin:$PATH
cd /opt/homebrew/bin/
PATH=$PATH:/opt/homebrew/bin
echo export PATH=$PATH:/opt/homebrew/bin >> ~/.zshrc
Run the commands in that order in terminal, you'll be editing the path and creating the missing .zshrc file, exporting the path to this new file.
Now you should be able to use:
brew doctor
It should say: "Your system is ready to brew."
This has helped me:
Add Homebrew to your PATH in ~/.zprofile:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile eval "$(/opt/homebrew/bin/brew shellenv)"