I recently installed iTerm2 and ZSH (with oh-my-zsh) after some months of very light usage of the stock Terminal on Mac OS.
I heard of a tool called "z" and installed it via brew with brew install z
. I used it for one night with no problems. Later on it stopped working, saying zsh: command not found: z
. I tried installing it again, and was met with Warning: z-1.8 already installed
.
How does this make sense? It's installed but the command is not found? How could I go about restoring this functionality?
Thanks!
Best Answer
One can inspect the list of files installed by a Homebrew formula via
brew list -f <formula_name>
. In this case, the output should likeNote that in this case there's no command (and not even
bin
), just az.sh
. This makes sense becausez
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 sourcez.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,Of course you should take that advise with a grain of salt, and use more modern and human-readable shell syntax:
Or
if you know your Homebrew installation is in
/usr/local
.